[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleSoft Programming Examples?



aiiadict@gmail.com wrote:
On Aug 30, 7:17 pm, Jcarlson1701 <jcarlson1...@gmail.com> wrote:


Are there any places on the web that have programming examples
(apps, games, etc...)


those aren't the best to learn from in my opinion....

In general, I agree, but one of the best ways to *really*
learn a language (not just enough syntax to type in a program)
is to read well-written, properly "styled", non-trivial
programs, just as the best way to improve your writing skills
in any language is to read good literature in that language.

In this way, you improve your "vocabulary" and your structuring
skills, and learn new, useful idioms.  These are things that
are seldom learned from reference manuals or command examples.

just ask a specific question and we'll answer it for you.

here's a few examples on how to get different types of input,
how to make decisions based on input (IF THEN),
how to draw dots to the low res screen, and how to move the
cursor around on the screen under keyboard control

10 print "hello"
20 input "press return";a$
30 home
40 input "type your name followed by return";b$
50 home
60 print b$;" typed in this program"

70 print
80 print
90 input "type something, followed by return";c$
100 home
 110 print "you typed ";c$
120 print "type L for left, R for right, e for Exit"
130 get d$
140 if d$="R" then print "right"
150 if d$="L" then print "left"
160 if d$="e" then goto 200
170 goto 120
200 gr
210 x=10:y=10
215 ox=x:oy=y
220 color = 5:plot x,y
300 vtab 21
310 print "-I- cursor movement"
320 print "JKL"
400 get a$
410 if a$="j" then x=x-1
420 if a$="L" then x=x+1
430 if a$="i" then y=y-1
440 if a$="k" then y=y+1
450 if x=ox and y=oy then goto 400
460 color = 0:plot ox,oy :rem erase old cursor
470 color = 5:plot x,y :rem draw new cursor
480 ox=x:oy=y
490 goto 400

There, see how useful a working example is?  ;-)

Now the next lesson might be how to write a keyboard
polling loop, so that the program remains "live" while
waiting for user input...  Or how to improve readability
by inserting "blank" lines containing only a colon.

Examples are invaluable for showing how to do things--even
"unpretty" things, like how to save space at the expense of
readability!  ;-)

-michael

NadaPong: Network game demo for Apple II computers!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it's seriously underused."