BEGIN  mÿ yÚ1:Ù7:ç1:û:õ¬10 ,9 ;"STOP THE TAPE":ëN=1Ì10 :×.1}LÌÌÌ,10 :óN:ò100d $û:õ"  NOUGHTS AND CROSSES " Äõ''"This month an example of how to get the computer to play a game against you."''"The algorithm used to calculate the computer's moves are not themost effective and the Spectrum can be beaten." ({õ''"The program has REMs throughout and you may find that with some thought you can persuade it to play a stronger game." *@õ'"Have go and then examine the listing if you are curious." -Eõ#1;¬0,9 ;"PRESS ANY KEY":ò0:û:ì100d 20õ#1;¬0,0;"Another game?(y/n)" <ñk$=¦:úk$=""Ëì60< F;úk$="n"Åk$="N"Ëû:õ¬10 ,9 ;"RUN THE TAPE":ï"" Pû dí1000è:êinitialise ní2000Ð:êdisplay xí3000¸ :êwho starts? ‚.úg$="human"Ëì150–:êstart with human move Œí5000ˆ:êspectrum move. ‘í6000p:êupdate display –í4000 :êhuman move ›í6000p:êupdate screen  í7000X:êcheck for winner. ª ì140Œ ´êend program. ¾ È èêinitialise ò éb(9 ):él(8,3) ÷¹êarray b=board. 0 for blanks, 1 for computer, -1 for human. array l=the set of 8 rows of three positions in line. ü0ën=1Ì9 :ñb(n)=0:ón:êset blanks å1070.:ëw=1Ì8 ãx,y,z 0ñl(w,1)=x:ñl(w,2)=y:ñl(w,3)=z $ów .[ä1,2,3,4,5,6,7,8,9 :êhorizontal lines 8Yä1,4,7,2,5,8,3,6,9 :êvertical lines B;ä1,5,9 ,3,5,7:êdiagoals Lþ Ð êdisplay Úën=1Ì3 äëm=0Ì2 îNõ¬2+m*6,2+9 *(n-1);3*m+n:êõsquare numbers. øóm ón  'ö15,112p:ü225á,0 &ö15,64@:ü225á,0  %ö87W,0:ü0,160  *&ö159Ÿ,0:ü0,160  4þ ¸ êstart Â<õ#1;¬0,0;"Do you want to go first?((y/n)" Ìña$=¦:úa$=""Ëì3020Ì Öñg$="spectrum" àúa$="y"Åa$="Y"Ëñg$="human" êþ  êhuman go ªî"Enter square";n ´úb(n)É0Ëì4010ª ¾ñb(n)=-1 Èþ ˆêspectrum go ìêcheck if full öñblanks=0 ën=1Ì9  %úb(n)=0Ëñblanks=blanks+1 ón 'úblanks=0Ëì9100Œ#:êgame over úblanksÈ8Ëí5900 :þ (úblanks>1Ëì5200P -!êif only one blank then fill it. 2ën=1Ì9 <úb(n)=0Ëñb(n)=1 Fón:í7000X:ì9100Œ# Pêlook for winner Zën=1Ì9 dúb(n)É0Ëì5280  nñb(n)=1:êtemporary ‚ í7000X –ñb(n)=0  ón ´êlook for block ¾ën=1Ì9 Èúb(n)É0Ëì5510† Òñb(n)=10 :êtest Üëw=1Ì8 æ_úb(l(w,1))+b(l(w,2))+b(l(w,3))=8Ëñb(n)=1:þ:êopponent blocked ðów úñb(n)=0 ón  êforks? ,ën=1Ì9 6úb(n)É0Ëì5510† @Bñlines=0:êcount lines with one blank and two of our pieces. Jñb(n)=1:êtry this. Tëw=1Ì8 ^Núb(l(w,1))+b(l(w,2))+b(l(w,3))=2Ëñlines=lines+1 hów r&úlines>1Ëþ:êsoon triumphant |ñb(n)=0 †ón àêopponent forks? ôën=1Ì9 þúb(n)É0Ëì5710N Hñlines=0:êcount lines with one blank and two of opponents pieces. ñb(n)=-1:êtry this. ëw=1Ì8 &Oúb(l(w,1))+b(l(w,2))+b(l(w,3))=-2Ëñlines=lines+1 0ów :1úlines>1Ëñb(n)=1:þ:êfork foiled. Dñb(n)=0 Nón ¨5êif you get here then a random move will have to do.  êrandom move ñn=º(1+¥*9 )  úb(n)É0Ëì5910 *ñb(n)=1 4þ pêdraw marks u#ñd=1:úg$="human"Ëñd=-1 zën=1Ì9 „ñy=º((n-1)/3) Žñx=n-y*3 ˜!ñx=568+68D*(x-1) ¢ñy=136ˆ-480*y ¬úb(n)=dËí62008:êcross ¶úb(n)=-dËí6300œ:ênought Àón Êþ 8êcross B*öx-10 ,y-10 :ü20,20 L+öx-10 ,y+10 :ü20,-20 Vþ œênought ¦Øx,y,10 °þ Xêcheck for winner lëw=1Ì8 Š3ñx=b(l(w,1))+b(l(w,2))+b(l(w,3)) ”ú½x=3Ëì9000(# žów ¨þ #(êfinish with winner. #2ña$="SPECTRUM WINS" #<úx=-3Ëña$="YOU WIN" #F4õ¬0,3;Û1;a$:í6000p:ì502 #Œêdraw #–8õ¬0,5;Û1;"DRAW":í6000p:ì502 '9ý:ø*"m";1;"BEGIN"Ê20:Ö*"m";1;"BEGIN":â 'ý:ø"BEGIN"Ê10 ¦