REM Project: Logo REM Created: 8/10/2006 12:15:55 PM REM REM ***** Main Source File ***** REM make camera 1 color backdrop 1,rgb(255,255,255) sync on global dim opperation(1000) global dim number(1000) global dim linecords(10000,4) global dim epeat(1000,3) global dim funct$(100) global dim funct(100,100,2) global dim fun(1) fun(1)=1 global lines global op=1 global rep global pe size = 1 global c global c$ cls restore turtle for y = 1 to 11 for x = 1 to 7 read z if z = 1 box x*size,y*size,(x+1)*size,(y+1)*size endif next x next y get image 1,0,0,8,12 sprite 1,screen width()/2-7/2,screen height()/2-11/2,1 ink 0,0 if file exist("fun")=1 then load array "fun",fun(1) if file exist("opperations")=1 then load array "opperations",funct(1000,1000,2) if file exist("names")=1 then load array "names",funct$(1000) do if scancode()=b else b$=b$+inkey$() if keystate(14)=1 and len(b$)>1 then b$=left$(b$,len(b$)-2) endif if returnkey()=1 disect(b$) b$="" endif b=scancode() text 0,0,b$ for i=0 to lines line linecords(i,1),linecords(i,2),linecords(i,3),linecords(i,4) next i sync wait 10 if shiftkey()=1 save array "fun",fun(1) save array "opperations",funct(1000,1000,2) save array "names",funct$(1000) end endif loop function disect(line$) for i=1 to len(line$) c$=c$+mid$(line$,i) if c$="fd" or c$="forward" number(op-1)=c opperation(op)=1 op=op+1 lookfornum=1 c$="" c=0 endif if c$="bk" or c$="backward" number(op-1)=c opperation(op)=2 op=op+1 lookfornum=1 c$="" c=0 endif if c$="ri" or c$="right" number(op-1)=c opperation(op)=3 op=op+1 lookfornum=1 c$="" c=0 endif if c$="lt" or c$="left" number(op-1)=c opperation(op)=4 op=op+1 lookfornum=1 c$="" c=0 endif if c$="pe" or c$="penup" pe=1 c$="" c=0 endif if c$="pd" or c$="pendown" pe=0 c$="" c=0 endif if c$="posx" number(op-1)=c opperation(op)=6 op=op+1 lookfornum=1 c$="" c=0 endif if c$="posy" number(op-1)=c opperation(op)=7 op=op+1 lookfornum=1 c$="" c=0 endif if c$="rangle" number(op-1)=c opperation(op)=8 op=op+1 lookfornum=1 c$="" c=0 endif if c$="langle" number(op-1)=c opperation(op)=9 op=op+1 lookfornum=1 c$="" c=0 endif if c$="cs" number(op-1)=c opperation(op)=10 op=op+1 lookfornum=1 c$="" c=0 endif if c$="to" f=1 number(op-1)=c op=op+1 lookforword=1 c$="" c=0 endif if c$="re" number(op-1)=c opperation(op)=5 op=op+1 lookfornum=1 c$="" c=0 endif if c$=funct$(1) and len(c$)>2 for i=op to op+funct(1,0,0) opperation(i)=funct(1,i,1) number(i)=funct(1,i,2) next i op=funct(1,0,0)+1 c$="" c=0 endif if c$="[" epeat(op-1,1)=op rep=op-1 c$="" lookfornum=0 endif if c$="]" epeat(rep,2)=op c$="" lookfornum=0 c=c*10 endif if c$=" " if c>0 then lookfornum=0 c$="" else if lookfornum=1 c=c*10+val(c$) c$="" endif endif if lookforword=1 if right$(c$,1)=" " and len(c$)>1 funct$(fun(1))=left$(c$,len(c$)-1) c$="" lookforword=0 endif endif next i number(op-1)=c/10 if f=1 for i=1 to op-1 funct(fun(1),i,1)=opperation(i) funct(fun(1),i,2)=number(i) next i funct(fun(1),0,0)=i fun(1)=fun(1)+1 goto past endif for i=1 to op-1 j=i if opperation(j)=5 for k=1 to number(i) for j=epeat(i,1) to epeat(i,2) if opperation(j)=1 then forward(number(j),1) if opperation(j)=2 then forward(number(j),0) if opperation(j)=3 then right(number(j),1) if opperation(j)=4 then right(number(j),0) next j next k endif i=j if opperation(j)=1 then forward(number(j),1) if opperation(j)=2 then forward(number(j),0) if opperation(j)=3 then right(number(j),1) if opperation(j)=4 then right(number(j),0) if opperation(j)=6 then offset sprite 1,-number(j),sprite offset y(1) if opperation(j)=7 then offset sprite 1,sprite offset x(1),number(j) if opperation(j)=8 then rotate sprite 1,number(j) if opperation(j)=9 then rotate sprite 1,-number(j) if opperation(j)=10 undim linecords(1000,4) dim linecords(10000,4) paste sprite 1,screen width()/2-7/2,screen height()/2-11/2 offset sprite 1,0,0 endif next i past: f=0 op=1 lookfornum=0 c$="" c=0 endfunction function forward(c,forward) if pe=0 lines=lines+1 linecords(lines,1)=sprite x(1)-sprite offset x(1) linecords(lines,2)=sprite y(1)-sprite offset y(1) endif if forward=1 then move sprite 1,c if forward=0 then move sprite 1,-c if pe=0 linecords(lines,3)=sprite x(1)-sprite offset x(1) linecords(lines,4)=sprite y(1)-sprite offset y(1) line x1,y1,x2,y2 endif endfunction function right(c,right) if right=1 then rotate sprite 1,sprite angle(1)+c if right=0 then rotate sprite 1,sprite angle(1)-c endfunction Turtle: data 0,0,0,1,0,0,0 data 0,0,1,1,1,0,0 data 0,0,1,1,1,0,0 data 1,0,1,1,1,0,1 data 0,1,1,1,1,1,0 data 0,1,1,1,1,1,0 data 0,1,1,1,1,1,0 data 0,1,1,1,1,1,0 data 0,1,1,1,1,1,0 data 1,0,1,1,1,0,1 data 0,0,0,1,0,0,0