Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
PerlMonks  

What was your first program?

by Ovid (Cardinal)
on Nov 13, 2000 at 04:41 UTC ( #41240=perlmeditation: print w/ replies, xml ) Need Help??

I was chatting with jepri recently and checked out his home node. He lists the following as his first program:
10 BEEP 20 GOTO 10
Boy, did that bring back memories! It’s been a long time since I have thought about my early days of playing with computers and I can’t help but smile as I reminisce. The first program that I remember writing (besides the obligatory “hello world”) was a simple tank game that I started working on back in 1982. Basically, the computer randomly placed two tanks (two array locations) and randomly fired shots from each tank. It would display to the screen the tank’s alternating shots and the first tank to hit the other was the winner. Of course, it was completely random and not really a game. I was just playing around and having a blast.

My first really significant program was a graphics processor that I wrote in 1984 for the old TRS-80 (Trash 80) computer. Since only low-resolution graphics were available, I had to use several screens to get a decent picture. The program would write the separate screens to different files and use the data from all of those files to send the simple line drawings to a dot-matrix printer.

Around the same time I was taking a word processing class that required I learn ten-key by touch on the computer’s numeric keypad. I thought it was really boring so I hacked into the program and had it create randomly generated scores for me (around the same score level that I currently had, to avoid arousing suspicions).

Ahh... those were the days.

I would love to hear about some of the first programs that other monks have written that may have a "nostalgic" feeling for them.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

Comment on What was your first program?
Download Code
RE: What was your first program?
by Fastolfe (Vicar) on Nov 13, 2000 at 04:55 UTC
    (With apologies to Matt Groening...)
    10 SIN 20 GOTO HELL 10 HOME 20 SWEET 30 GOTO 10
    Futurama is such a great show.
RE: What was your first program?
by jepri (Parson) on Nov 13, 2000 at 05:02 UTC
    The worst part is that it wasn't my program. I was bored, kicking my heels in the corner while the adults talked about boring adult things. One of them noticed how bored I was as he walked out, said "Here, try this". He typed it in to the funny-looking box next to me and left chuckling.

    As it turns out, my first real program was a tank game in qbasic. Tanks seem to be a real attraction. Two players controlled tanks which fought in a maze. The shots could bounce off walls. Then I improved it too much and it broke :( Actually, I don't think I written a program I haven't broken by adding too many features.

    ____________________
    Jeremy

      Yeah, there's no better way to start programming than messing with games. One of the first pieces of programming I ever did was modifying a few initial variables in the "Lemonade Stand" game on my Apple IIe. (It's so much more fun to start with a few thousand dollars.) Later on, I remember tweaking Microsoft's "Gorillas" QBasic program, adding a "nuclear bomb" option.

      Ahh, those were the days.

      --
      Ryan Koppenhaver, Aspiring Perl Hacker
      "I ask for so little. Just fear me, love me, do as I say and I will be your slave."

RE: What was your first program?
by little (Curate) on Nov 13, 2000 at 05:45 UTC
    I don't remember how it exactly looked alike but my first program was one to let cycle the elements of a 7 segment display on a machine driven by a Zilog Z80 A (rebuild).
    It's strange but first I learned assembly and machine code and I always remember our tutor saying :" ..look boys, one day you'll be thinking in machine code - ehm - as I already do."

    Have a nice day
    All decision is left to your taste
RE: What was your first program?
by runrig (Abbot) on Nov 13, 2000 at 05:46 UTC
    I don't remember exactly what the program was, but it was on this this thing that looked like a big adding machine (remember those?), and was probably one of the first programmable calculators. We had to hand punch the cards with paper clips and feed'em through the card reader to get our program in. It had about 4 or 7 registers we could store variables in. I'm sure one of the first programs just counted numbers and printed 1,2,3, etc., and maybe a later one found prime numbers or something.

    First semi-significant program in a real programming language was a text-based Star-Trek game written in FORTRAN, on a Dec-10.
RE: What was your first program?
by AgentM (Curate) on Nov 13, 2000 at 06:01 UTC
    I'm actually a younger monk, so I don't remember toying with PDP-8s or even 11s (since I never did). My school was especially lucky to have Apple Is and IIs. We used LogoWriter (yeah, the four retarded turtles). Later, we used the LegoLego to make tanks (what's with the tanks today?). I thought this was especially neat since the parts came with light sensors and stick sensors (stop the motor when this part gets hit). Later, I moved move up to HyperCard 1.8 (WOW!) which let me make simple animations and short, useless applications. From HyperCard, I switched schools and QBASIC was forced upon me. I picked that up quickly but I realized quickly that it lacked finesse. I made sure to quickly learn C and C++ and ended up in Perl after the CGI revolution. Neat eh?
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
RE: What was your first program?
by jptxs (Curate) on Nov 13, 2000 at 07:10 UTC

    Man, I cannot remember what the first thing I did was, but I do know I did it on a Tandy that was hooked up to my TV. My mom could not afford the then ubiquitous Atari 2600 so she got this thing from Radio Shack. It came with a cartridge for a game called dungeon and a another for BASIC. The best thing I remember writing was a trivia game that stumped my mom once. I was darn proud of that...

    <myExperience> $mostLanguages = 'Designed for engineers by engineers.'; $perl = 'Designed for people who speak by a linguist.'; </myExperience>
RE: What was your first program? (Applesoft and knee curves)
by ybiC (Prior) on Nov 13, 2000 at 07:35 UTC
    Wow - good question, Ovid!

    I remember using an AppleII (bought for VisiCalc tax accounting on the farm) to write mathmatical calculation progs for college.   Something about determining gain and linear portion of curve given Q and who knows what else.   Must have been amplifier transistors - how analog.   {grin}

    Bet I still have those 5" floppies around somewhere, wonder if they're still good?   Hmmm... Debian has an AppleII emulator.   Hmmm...
        cheers,
        Don
        striving for Perl Adept
        (it's pronounced "why-bick")

(tye)RE: What was your first program?
by tye (Cardinal) on Nov 13, 2000 at 10:39 UTC

    My first program found the prime factorizations of numbers. I was taking an "intro to computers" course from the local college when I was in 7th grade. They didn't teach programming, but before long I found the source code (in BASIC) to one of the games and was able to understand enough that I tried programming before/after class. With my math background, I wasn't sure I could do, for example:

    100 let x= x + 1
    so I wrote the entire program without ever using the left-hand variable of an assignment on the right-hand side. The program ended up with two nearly identical halves with the flow of control alternating between them. It actually worked in the end, but it took me days to write it.

    I also remember completely not understanding computers when I started that class:

    Instructor: "We use programming languages to tell the computer what to do."
    Me: "What if it says 'no'?"

            - tye (but my friends call me "Tye")
(kudra: spaghetti) RE: What was your first program?
by kudra (Vicar) on Nov 13, 2000 at 15:36 UTC
    This is a fun thread.

    I can't remember my very first program (although it probably resembled the one Ovid posted) but I can remember one of the ones I wrote around then which was based on those 'choose your own adventure' books. It was a story that took you through a haunted house and presented you with two choices after each chunk of narrative. There was one correct path that took you to the treasure and many, many ways to die--if you made a wrong turn you'd die, but you might not die until you'd made 20 more choices.

    It was pretty simple code, consisting of little other than a few sounds, prints--and gotos: it was horrible spaghetti code. I'd allot myself 200 lines for finishing up a dying branch, and then decide to string things along, so I'd make line 210 (the right thread) goto another 200 lines ahead, and make line 200 (the wrong thread) goto 220, and continue until I hit 400 and then realize I needeed more space... I can remember having a piece of paper that just consisted of line numbers and a note as to what thread was being picked up there.

    For some reason I stopped writing programs after that and didn't write any until high school, where I encountered a teacher who was obsessed with flow charts. The agony I suffered in that class kept me away from programming for several more years.

      I (vaguely) remember writing a QBASIC subroutine that would take a string and a substring, and search that string for an instance of a substring, so the program would continue depending on the user input. I was greatly obsessed with Zork at the time, particularly Return to Zork, and after buying the original Zork games at a pawnshop set about trying to write my own. There were many CASE-statements, let me tell you!

      I forget why I stopped... after having my "batch file commander" stage and my "write a QBASIC program for everything I can think of" stage I got fed up the languages I had to work with. Mom and Dad got me a Borland Turbo C++ compiler for my birthday one year and I just got frustrated with that too... didn't make it very far with the infinitely more complex language (at least it seemed so at the time). I believe I dropped programming altogether and started hitting the BBS scene and focusing on hardware. Beautiful, sweet, simple hardware. =) That was the end of that.

      A few years later I discovered mIRC-script. A year or two later, Linux, databases and Perl. It was downhill from there!

      Ah, memories...

      Alakaboo

      ...a short time later...

      Great scott, I found it! LOL... You aren't going to believe this:

      DEF fnCheck (Dir$, Targ$, Length) fnCheck = 0 FOR X = 1 TO 50 IF MID$(Dir$, X, Length) = Targ$ THEN fnCheck = 1 NEXT X END DEF INPUT "String to search: ", Dir$ INPUT "String to find: ", Targ$ Targ$ = UCASE$(Targ$) Dir$ = UCASE$(Dir$) IF fnCheck(Dir$, Targ$, LEN(Targ$)) = 1 THEN PRINT "Is in string." ELSE PRINT "Not in string." END IF

      {dies of laughter} I also found a H2O trivia program for 6th grade science class, a modem chat program for two people to connect via analog modem and type with each other, an ASCII flat file parser that would build a webpage out of a small database, and a program I wrote that would search a database of the Windows 95 CAB files and tell you which CAB the file you need is in. Oh, brother!

      Ouch, my first were also spaghetti code, though I didn't get to adventure games until later.

      I first programmed on a Commodore Pet, followed by the Vic-20, Commodore 64, Commodore 128, Amiga 500, etc. Well, on the early ones, they tokenized the Basic so it fit better in the ~2.5K of RAM it had. But you could also enter it in a "shortened" format, using the first two letters, one shifted. And print was just a ?. Lines could be up to 255 characters long, but the editor would only handly up to 4 screen lines, which was either 22 chars or 40 chars, depending on which box. So I would write lines so full that when they were expanded, they were over 4 lines and I could not go back and edit them. All in the quest to save a few bytes of memory for line numbers, because 2.5K jsut is not a lot.

      My first programs were games, something that always facinated me about computers. Now my efforts are a more directed, but a goal if I ever hit the lottery is to quit where I work and find a game company and "apprentice" to them. I am especially interested in trying to make computer players for games that feel like people.

      =Blue
      ...you might be eaten by a grue...

      Remarkable how similar this account is to my own experiences. I started programming on the Apple ][+, and quickly began making choose-your-own-adventure style games in Apple Basic. One of my very early games was "Smurf"*.

      I wrote Smurf on my friend's machine, and stored it on a audio cassette tape. His father had decided that 5 1/4" floppy disk drives were too expensive, and hooked up an old cassette recorder instead... though he did splurge on a 100 baud modem. Anyway, I graduated to floppies as Apples started appearing in school, but lack of storage space remained a problem.

      Thinking back on it, I'm sort of amazed at some of the things I wrote. My mind was so captivated by what I was doing, that I had no problem keeping track of God knows how many lines of totally unstructured code. Eventually, someone showed me subroutines. I thought about them, but soon decided that there was nothing you could do with them that you couldn't do with gotos.

      The storage problem kept coming up. I couldn't afford many floppies, and they kept filling up with big games like Lode Runner, Oregon Trail and Karateka. Hence, I had to compress my code. Amongst other things, I recall systematically leaving all unnecessary whitespace out, and numbering my lines 1 2 3 4...

      Eventually, though, things went bad. My efforts to make games using hires graphics in basic weren't panning out; they were too slow, and (as I knew nothing about video refresh rates or buffering) they flashed annoyingly. I knew I had to move on to "assembler", whatever that was, but nobody seemed to know how to program assembler.

      And then the Macintosh came out. That killed it. The Computer for the Rest of Us shut me out in the cold. It was so cool in so many ways... but how the heck did you program the thing? Where was the prompt? I had no computers I knew how to program, and nobody seemed to know enough to help. My interest died, and I'm rather surprised that I ever wrote code again. Linux brought me back in from the cold.

      And Perl made it fun. Perl is, IMHO, the coolest thing thing since Apple Basic. :-)


      * This in itself requires a word of explanation. Today we are in quite a golden age for cartoons. In the early '80s, cartoons were mindless, bland, dreadfully condescending bits of fluff (not unlike most everything on TV). VCRs were for people with money, and it would be years until Robotech introduced people to the sophistication of Anime. So don't be too quick to excoriate what today would be pretty bad stuff. With elements of medieval fantasy and halfway creative art, the Smurfs were comparatively very, very interesting.

RE: What was your first program?
by neophyte (Curate) on Nov 13, 2000 at 15:52 UTC
    My first program ... what a terrible memory ...
    I was still in school, and teaching things to do with computers was at it's very beginning in Germany. I had no computer myself, but could only use the ones at school and only when I had the lessons. No time to practise, to try things ... so not really fun. Programming language was TurboPascal then, and our teacher was reading his very first TurboPascal book during that year, and no he had no prior programming experience.

    One of the very first tasks was to have TurboPascal to draw a circle on the screen. When the term was over I had my circle-script and I took Latin and quit programming for a good while.

    neophyte

      I cannot remember to my first program, because since I know perl I forgot every other languages and memories about them :-))) And since I know Linux I dont remember Windows :-)))

      -- tune

RE: What was your first program?
by turnstep (Parson) on Nov 13, 2000 at 20:46 UTC

    The earliest I can recall for sure was a simple drawing program on an early Apple in BASIC. You used the arrow keys to move, the space bar to toggle from "draw" to "move", and the number keys to change the color.

    I had some sort of earlier computer too, I think it was a Sinclair something (??) and I know I wrote some programs on that, but the only thing I can remember is that you actually stored your files on a regular audio tape, with a normal tape player, by audio and microphone extension jacks. You could actually listen to your programs (resembled the well-known "modem connect" noise, but had a distinct difference).

    After a while, I managed to write one of those adventure games as well. I don't know how I managed to do all that string parsing ("DROP THE BOX", "KILL TROLL", "LIGHT THE LANTERN") and everything else involved in a language other than Perl. Where was Larry? :) So much spaghetti produced for so little output.

      I remember writing one of those adventure games, too! The only problem was that I didn't want to be stuck with a simple two-word command. I wanted full "Zork sentence" capability. My program would scan through the input and take the first three letters of every word (limited memory) and match those up with the words in DATA statements. My test sentence (my dog, I remember it after 15 years!) was "hit the skeleton with the sword, take his ring and then walk north and touch the altar." It took 8 seconds for the BASIC program to parse that into numbers. Then, the program would branch to various parts of the program when it had a "verb" number and apply the action (if possible) to the "noun" number.

      Since 8 seconds was too long for the program to parse the input string, I tought myself a little 8088 assembler and rewrote the routine in about a week. My goal was to get the program to start recognizing adjectives and compound-complex sentences, but then my roommate moved and took his computer with him. I didn't touch a computer again for another 9 years.

      It's good to be back :)

      Cheers,
      Ovid

      Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

(jeffa) RE: What was your first program?
by jeffa (Chancellor) on Nov 13, 2000 at 23:37 UTC
    I started out on the TI99-4A when I was eleven. My first 'real' program used the TI's graphics functions to draw a sprite of a bull. I made 2 or 3 versions with it's legs moving - and one of it squating (where is the going? . . )

    Basically, the bull came in from the right side, made it to the middle, squated, left a large suspicious heap, and continued it's path off the left side of the screen.

    Then, a little stick figure man with a hat and broom followed the same path and pushed the heap off of the left side of the screen.

    These basic techiniques allowed me to write my first game shortly afterwards : Moneybags!

    Two bags on the screen, one bag contains a gold coin, the other a bomb. The user moves a cursor to one of the bags and either gets a point or dies.

    wow

RE: What was your first program?
by arturo (Vicar) on Nov 13, 2000 at 23:44 UTC

    I really don't recall what my first program was (that I didn't just type in from a book). I remember the posh computer mags those days sometimes came with cassette tapes, so you didn't have to type in those 8k programs.

    The only thing I remember programming is that at some point, I wrote an assembler of sorts for the Vic-20's 6502. I used that to help me write a "galaga" style shoot-em up game (I flatter myself ... it presented a field of moving "stars" that scrolled down the screen, and you could move through the field and shoot an occasional target that scrolled down but couldn't move left-to-right). Now, I bet I couldn't do anything nearly as 'sophisticated' without a lot of work =)

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      I don't remember what we programmed on the PDP (probably a couple math programs in fortran), but then we got some Commodore Pets.
      I did a lame missile command style game and then there was an "animation" assignment. Besides the actual one I did a quick one that was more of a gordian(sp?) knot solution.
      You could print horizontal line characters from top to bottom. There were eight of them. I printed that with no line return and then just looped.
      That would wrap and it made a good impression of a wheat field being blown by the wind.
      The teacher was a bit miffed when he found out it was a two line program.
RE (tilly) 1: What was your first program?
by tilly (Archbishop) on Nov 14, 2000 at 09:14 UTC
    Well I don't remember my first program, but I remember my brother's. It asked for your name. If you entered his name it would say you were the greatest, my name, you sucked, and it would ask my sister if it could borrow some money.

    For some reason he liked that computer more than I did...

RE: What was your first program?
by a (Friar) on Nov 14, 2000 at 10:35 UTC
    nothing to be proud of but my first was as a 6/7th grader ('71?) who snuck into the High school's computer club meetings. We had a teletype to the University and I have the punch tape still though the prog was a loop in basic that (besides violating a number of rules) added up to 10 and exited.

    a

RE: What was your first program?
by mitd (Curate) on Nov 14, 2000 at 11:20 UTC
    Here is an example of some of the first code I wrote.

    Can you tell what each does and what kind of computer it might rub on.

    Mystery Code 1:

    start LDY #$FF loop1 LDX #$FF loop2 DEX BNE loop2 DEY BNE loop1 RTS
    Mystery code 2:
    mlt16 LDA #$00 STA $26 STA $27 LDX #$16 nxtbt LSR $21 ROR $20 BCC align LDA $26 CLC ADC $22 STA $26 LDA $27 ADC $23 align ROR A STA $27 ROR $26 ROR $25 ROR $24 DEX BNE nxtbt RTS

    The first correct answer to both questions will be sent a genuine picture/jpeg of an orginal single-sided, single-density 8 inch floopy disk drive (I think maybe). mitd-Made in the Dark
    'My favourite colour appears to be grey.'

      Both run on 6502 processors.

      Code #1 is a delay loop.
      Code #2 is a 16 bit unsigned multiply (multiplies $20/$21 by $22/$23, returning the result in $24/$25/$26/$27).

      Update: OK, I couldn't resist. I dug out the 6502 assembler and emulator to test code #2. Now, admittedly, the emulator could be broken, but I didn't get any results that made sense for either a multiply or divide. I spent about 45 minutes playing with this, and the simulator seems to be executing as I would expect. But the resulting $26/$27 locations never come up with any valid values using $20/$21 and $22/$23 as inputs (the higher address is the high byte of each word, so I had byte ordering correct).

      And since code #1 was going for maximum delay, you could have gotten a little more delay by changing it to:
      start	LDY #$FF    
      loop1	LDX #$FF  
      loop2	DEX       
      	BNE loop2  
      	DEY        
      	BNE loop2  
      	RTS           
      
      You're resetting X to #$FF, when it's already 0, losing 255 free 2 cycle delays.

      --Chris

      e-mail jcwren
RE: What was your first program?
by kaatunut (Scribe) on Nov 14, 2000 at 13:46 UTC
    c:\>edit testi.bat @echo off :alku echo hello pause cls echo hello world pause cls goto alku

    It's not exactly that but the principle's same. The first one that wasn't a test, that is.

RE: What was your first program?
by adamsj (Hermit) on Nov 14, 2000 at 19:24 UTC
    I had several milestones:

    My first program would have been for chemistry class, back in '74--our college had, um, a 360? 390? I don't remember--to solve the gas law, cube roots and all that stuff, in Fortran.

    My first real original production item was in qbasic,in 1985. There was a piece of software called DataStar (right--part of the WordStar group), the first RDBMS I ever used. I was given a 6000-card mailing list, with people's interests, disinterests, phone numbers--you name it--and told to make it into a real mailing list. I did the whole thing from scratch (including the data entry). Then I had to write a qbasic program to use the data--much easier.

    My first paid professional job (in 1993) was done in, god help me, Pascal--it was a brute force (I thought I could throw algebra at it, but I failed) enumeration of the possible bends and configurations of protein backbones.

    I think I've said too much. Just remember what Saint Gracie Allen says:

    They laughed at Joan of Arc, but she went right ahead and built it.

(Guildenstern) RE: What was your first program?
by Guildenstern (Deacon) on Nov 14, 2000 at 20:55 UTC
    My _very_ first program was one from a magazine. Our classroom had an Apple ][ with *gasp* a color monitor, but nobody had any idea what to do with it. The teacher handed me a program listing and said, "Here type this in and see what happens." What happened was we had a screen full of hearts that shifted colors through the available palette. I was hooked.
    I can still remember being in middle school and getting in trouble for using "HGR" instead of "GR" when writing graphical applications on our Apple ][e's. One of my fondest memories is when our school acquired an IBM clone and tried to get the students to use it as well. Nobody wanted to touch it, because we all knew Apples were better and IBM would never last.
    In successive years, I think I got a dose of just about everything. Logo and BASIC on the Apples, plus Pascal (I remember needing the two disk drives to compile _and_ run!). Eventually I moved up to teh fascinating land of gwBASIC, where I wrote a fun little program that made nasty crunching type sounds and informed the hapless user that his hard drive had just been reformatted. What made it even more fun is the fact that my teacher talked me into installing it onto the principal's computer while he was distracted! Man, I miss those days....

    Guildenstern
    Negaterd character class uber alles!
RE: What was your first program?
by amelinda (Friar) on Nov 15, 2000 at 01:23 UTC
    Uhm. Possibly something written in BASIC on the good old TI99/4A my parents had when I was a youngun (hey man, we even had the speech synthesizer), or something written in BASIC on the good old Apple ][c we had. The first one that I can recall, though, was in LOGO (saints preserve me!) on a Commodore 64 in 5th grade; you gave it a few parameters, and it drew snowflakes. It might have been before we got the Apple, though.

    After that, I sort of drifted away from programming, and came back just in time to take a year of Pascal in my senior year of Highschool, and that awful disaster drove me away from programming for about three years. Then I finally found C++ (hate it if you want, it's saner than Pascal), and about the same time started messing with actually running UNIX boxes instead of just using them, and then about 2 years ago I discovered Perl. First Perl program I wrote was one that randomly picked a sig file out of a directory and copied it to my .signature file.

RE: What was your first program?
by FouRPlaY (Monk) on Nov 15, 2000 at 02:49 UTC
    While I don't remember my first program, I do remember the first program that impressed me.

    My dad had written it in QBASIC. It had a number you tried to guess at and everytime you got it wrong, it would print out a different and "funny" answer. Well, up to 5 wrong guesses.

    I thought my dad was the world's smartest man after seening that.



    FouRPlaY
    Learning Perl or Going To Die Trying

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://41240]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-04-20 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls