ZXTape!Shrdlu 666 623658j\,0 7s$(n)=" "+("small"n=1)+("big"n=2) c$(n)=" "+("blue"n=1)+("red"n=2)+("magenta"n=3)+("green"n=4)+("cyan"n=5)+("yellow"n=6) gn$(n)=" "+("square"n=1)+("oblong"n=2)+("triangle"n=3)+("circle"n=4) Ca$(n)=s$(o(n,1))+c$(o(n,2))+n$(o(n,3)) q$(n)=" "+("any"n=0)+("one"n=1)+("two"n=2)+("three"n=3)+("four"n=4)+("five"n=5)+("six"n=6)+("seven"n=7)+("eight"n=8)+("nine"n=9 )+("ten"n=10 ) Rh(x)=2+(1o(x,1)=2)+(1o(x,3)=2) '("o"+5)2019400$ A7:0:7:0:0:0:0: 610 ,0;"" ( 8000@ 2512 ,0;"Type help or some other command" d02000:v="o":200*action:v="o" n 100d  List k$=x$:7300 nomat=07100: z$="I can see:":7400 n=1nosha:o(n,1)0f(n)z$=" a"+a$(n):7400:o(n,5)0z$=" which is on top of the"+a$(o(n,5)):7400 n   Move k$=x$:7300 nomat17100: 1relation=0z$="Which way?":7400: :relation>2z$="I don't understand.":7400: ~drn=(-1relation=1)+(1relation=2):from=fmat:y$""k$=y$:7300:nomat17100: _to=o(fmat,4)+drn:to<1to>8z$="There's no room to do that.":7400: Yn=1nosha:o(n,4)=toz$="There's a"+a$(n)+" there already!":7400: Ho(n,5)=fromz$="What about the"+a$(n)+" on top?":7400: ̢n:wipe=1:printx=from:8800`":wipe=0:o(from,4)=to:o(from,5)=0:o(from,6)=0:8800`":z$="OK.":7400: W Put Xk$=x$:7300 bnomat17100: l/relation=0z$="What on?":7400: v9relation3z$="I don't understand":7400: ;from=fmat:k$=y$:7300:nomat17100: Tto=o(fmat,4):from=fmatz$="You can't put a shape on itself!":7400: ?o(fmat,3)>2z$="It won't balance!":7400: `height=o(fmat,6)+h(fmat):height+h(from)>10 z$="That's too high!":7400: Yn=1nosha:o(n,5)=fromz$="What about the"+a$(n)+" on top!":7400: Ko(n,5)=fmatz$="There's already a"+a$(n)+" on top!":7400: n:wipe=1:printx=from:8800`":wipe=0:o(from,4)=to:o(from,5)=fmat:o(from,6)=height:8800`":z$="OK.":7400:  Where is  k$=x$:7300 *nomat17100: 4lx=o(fmat,4):o(fmat,5)0z$="It's on top of the"+a$(o(fmat,5))+".":7400: >?wl=9 :wr=9 :nl=0:nr=0:under=0 Cn=1nosha HKo(n,4)xo(n,4)-x1z$="You'll confuse me if you have two shapes the same.":nosha=nosha-1:7400: tXo(nosha,4)=space:wipe=0:printx=nosha:8800`":z$="OK.":7400:  Destroy k$=x$:7300 nomat17100: Yn=1nosha:o(n,5)=fmatz$="What about the"+a$(n)+" on top?":7400: n 'printx=fmat:wipe=1:8800`" 8fmatnoshan=16:o(fmat,n)=o(nosha,n):n 8n=1nosha:o(n,5)=noshao(n,5)=fmat n -nosha=nosha-1:z$="OK.":7400: w Quit x7z$="Are you sure you want to quit (y/n)?":7400 !i$=:i$"y"i$"n"1410  i$="n" Rv="o":v="o":z$="Type 'RUN' and Enter to restart.":7400:10000' @ Help J,z$="In this program, you can instruct the computer to manipulate the objects above on the screen. The computer will try to give intelligent answers. For example, you could type in 'move the red circle right of the green triangle'. For a list of the words understood, type 'commands'.":7400:  Commands z$="I understand the words list, move, put, make, where is, destroy, left, right, on, and the names and colours of the shapes." z$=z$+" Some examples are: 'move the green triangle left' 'where is the small circle' 'list the red shapes' 'put the circle on the square'. "+17+6+"Press any key for more.":7400 &=""1830& 0z$="You can also abbreviate all of the commands and words down to their first three letters. For example, 'mov gre tri lef of red tri' would be interpreted as 'move green triangle left of red triangle'. To finish, type in 'quit'.":7400: Get input and analyse Dx$="":y$="":action=0:rel=0:end=0:7900  7800x end2000 )7700:end7600:2000 !action=number:action=7 7800x:end  )7700:end7600:2000 .type=32050:skip ignored words  ;type<47600:2000:expect a descriptor *x$=x$+type+number 47800x:end >)7700:end7600:2000 H+type42090*:next descriptor Rtype=321004 \&type=17600:2000 ftype=2relation=number p7800x:end z)7700:end7600:2000 type=32160p 3type<47600:2000:2 relatives !y$=y$+type+number:2160p ,inkey$ (1 to inmax) returned in inkey $g$=:g$<"1"g$>inmax6900  inkey=g$: 'Not unique' message vz$="I can"+("'t"nomat=0)+" see"+q$(nomat):7200 :z$=z$+". "+("Which do you mean?"nomat):7400: Add description to z$  "sflag=0:k$=""7260\ *<n=1̱k$2:t=k$(n)-3:nn=k$(n+1) 4t=1z$=z$+s$(nn) >t=2z$=z$+c$(nn) H)t=3z$=z$+n$(nn):sflag=1 Rn \sflag=0z$=z$+" shape" fnomat1z$=z$+"s" p Match function uf(10) all set by this 1=match 0=no match nomat (no of matches) & f(irst)mat also set  uses k$ to pass params (x$/y$) =n=1nosha:f(n)=1:n:nomat=nosha:fmat=1  k$="" n=1̱k$2:t=k$(n)-3:nn=k$(n+1):m=1nosha:f(m)=1o(m,t)nnf(m)=0:nomat=nomat-1 m:n f(fmat)=1 .fmat=fmat+1:fmat<11 7350 fmat=0:  Print z$ #1;0,0; 7z$<33!#1;0,0;z$:v="o": 8l=32 10 -1:z$(l)" "l:l=32 J#1;0,0;z$(l):v="o":z$=z$(l+1):7400 Error routine ;v="o":z$="I don't understand ":type=0z$=z$+w$ 7400: Find word in dictionary +9000(#+w$(1)-"a":w$=w$+" " )z$,type,number:z$=""end=1: (w$(3)z$7710 2 w Parse input xw$="":i$=""end=1: .i$(1)=" "i$=i$(2):7800x  n=1 *i$(n)" "n"; ""7910 z$=:z$=""7920 Vz$" "z$<""Ʊi$<59;i$=i$+z$:#1;0,1;i$;" ";:7910 <z$=13 #1;0,1;i$;" ";:v="o": _z$=12 Ʊi$>0i$=i$(̱i$-1):#1;0,1;i$;" ";:7910 .1}L,12 :7910 ?Set up variables @Do(20,6):f(10 ):nosha=5:objects + matches Jx1. size 2. colour 3. name 4. x-pos 5. status (0=ground) 6. height above ground TNsize: small or big colour: red/blue/green/ yellow (1-4) ^7name: square/oblong/ triangle/circle h5status: 0=on ground x=on object no. x r@8060|:n=15:m=16:o(n,m):m:n |D1,1,1,1,0,0:small blue square E2,2,3,3,0,0:large red triangle C1,2,4,4,0,0:small red circle F2,3,2,7,0,0: large green oblong V1,4,3,7,4,4:small yellow triangle on the oblong :wipe=0:m=15:printx=m:8800`":m !4 "`print an object (x) "jfpx=o(printx,4)*4-4:py=o(printx,6):o(printx,4)0 py=1+o(o(printx,4,3) "tpc=o(printx,2) "~psize=o(printx,1) "88870"+2*o(printx,3)+o(printx,1) "Pn=pypy+psize+(o(printx,3)=2):p$:wipe=1p$=" "(̱p$) "9 -n,px;pc;p$:n: " "","" ""","","" ""","","" ""","","","" " "","" """,""," " " "","" ""","","" #(-"a ",3,2,"",0,0 #)Y"bal",6,4,"blu",5,1,"big",4,2,"",0,0 #*Y"cir",6,4,"cya",5,5,"com",1,9 ,"",0,0 #+-"des",1,6,"",0,0 #,e #-f #.-"gre",5,4,"",0,0 #/-"hel",1,8,"",0,0 #0-"is ",3,5,"",0,0 #1j #2k #3Y"lis",1,1,"lef",2,1,"lar",4,2,"",0,0 #4Y"mov",1,2,"mak",1,5,"mag",5,3,"",0,0 #5n #6"obl",6,2,"off",2,4,"on ",2,3,"ont",2,3,"of ",3,4,"",0,0 #7-"put",1,3,"",0,0 #8-"qui",1,7,"",0,0 #9Y"rec",6,2,"red",5,2,"rig",2,2,"",0,0 #:Y"squ",6,1,"sma",4,1,"sha",3,5,"",0,0 #;Y"tri",6,3,"to ",3,1,"the",3,3,"",0,0 #<u #=v #>C"whe",1,4,"wha",1,1,"",0,0 #?x #@-"yel",5,6,"",0,0 #A"",0,0:z #A0=none 1=command 2=preposition 3=ignore 4=size 5=colour 6=shape #O15,63?,127,127,255,255,255,255 #Q240,252,254,254,255,255,255,255 $O255,255,255,255,127,127,63?,15 $Q255,255,255,255,254,254,252,240 $J0,7,31,63?,63?,127,127,127 $"O0,224,248,252,252,254,254,254 $,J127,127,127,63?,63?,31,7,0 $6O254,254,254,252,252,248,224,0 $@M24,24,60<,60<,126~,126~,255,255 $JC1,1,3,3,7,7,15,15 $TQ128,128,192,192,224,224,240,240 $^M31,31,63?,63?,127,127,255,255 $hQ248,248,252,252,254,254,255,255 $rM255,129,66B,60<,60<,66B,129,255 $|G6,12 ,205,0,14,201,0,0 $G6,12 ,205,0,14,201,0,0 $:3,10 ;"A.I. Program.";5,3;"Poking in data. Please wait.":9200#:n=0127:a:"a"+n,a:n: |