in reply to What was your first program?
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.
(alakaboo: ravioli) RE: (2) What was your first program?
by mwp (Hermit) on Nov 13, 2000 at 16:01 UTC
|
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!
| [reply] [d/l] |
RE: (kudra: spaghetti) RE: What was your first program?
by Petruchio (Vicar) on Nov 14, 2000 at 00:10 UTC
|
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. | [reply] |
RE: (kudra: spaghetti) RE: What was your first program?
by Blue (Hermit) on Nov 13, 2000 at 20:27 UTC
|
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... | [reply] |
|
|