[comp.sys.amiga] start of logo program...

hansb@ariel.unm.edu (The Amiga Programmer) (04/08/89)

Here is an idea that popped up in my head one morning that I decided
to "quickly" work up... a logo routine written in amigabasic.

It isn't totally finished, but I figured I would post it so if anybody
out there wanted to take a stab at it, feel free to do so.

(also, if any additions are put on, please send me a copy to use.)

I program in C usually, but I figured this might be a good net project
"just for the fun of it" and help out people that need a logo for the
schools.  I know there are two logos out there already, the public
domain one, and the "commercial" demo from 2 or so years ago, but
this is a start to a new one that the net can add to.

The program isn't finished, not by a long shot, but it at least has
an open-ended approach in which any self-propelled programmer out there
should be able to handle...

****cut here****
setup:
t=1
DIM z$(100):'list of possible commands
a$=CHR$(13)
p$=CHR$(191)+CHR$(8):'cursor with upside down questionmark
e$="Command not recognized -- "

'xxx is end of command list
WHILE z$(t-1) <> "xxx"
 READ z$(t)
 t=t+1
WEND

start:

WHILE endit=0
 IF a$=CHR$(13) THEN PRINT CHR$(187);" ";
 GOSUB getit
 GOSUB checkit
WEND
END

getit:
a$=INKEY$:PRINT p$;:IF a$="" THEN getit
PRINT a$;
IF a$ = CHR$(32) OR a$=CHR$(13) THEN RETURN
b$=b$+a$
GOTO getit:'one terrible goto thrown in for the BASIC environment ;-)

checkit:
FOR a=1 TO t-1
IF b$ = z$(a) THEN true=1
NEXT a
IF true THEN GOSUB doit:b$="":RETURN
PRINT:PRINT  
PRINT e$;b$
PRINT 
b$="":a$=CHR$(13)
RETURN

doit:
true=0
'no case statment in BASIC??  oh well.
IF b$="bye" THEN endit=1
IF b$="cs" THEN CLS
IF b$="to" OR b$="edit" THEN GOSUB editit
IF b$="lt" OR b$="rt" THEN GOSUB turnit
IF b$="fd" OR b$="bk" THEN GOSUB moveit
RETURN

askit:
GOSUB getit
q$=b$
r=VAL(q$)
s=r
RETURN

editit:
GOSUB askit
RETURN

turnit:
GOSUB askit
IF r<0 THEN r=0
IF r>360 THEN r=360
RETURN

moveit:
GOSUB askit
IF s<0 THEN s=0
RETURN

' data for commands follow this line

DATA "bye","pc","draw","home","cs"
DATA "edit","to","fd","bk","lt","rt"
DATA "xxx"

----cut here----

That is all of it...
***********************    Hans Bechtel
* Amiga Before    /   *
*      The Rest  /    *    hansb@ariel.unm.edu
************** \/ *****    (505) 275-2797