# Created by CaS msdos-dpmi version 1.1.0 # Author: Tom Lynn # Description: Text based noughts and crosses. # Works best on fx-9700 calcs, needs slight editing for non-widescreen. # Usable on newer calcs, but not as good as it is based on a scrolling # bug which was fixed for later models. # # The numbers on the keypad represent the squares. @@ Prog "~NOUGHTS+XS" ; Main program, run this. 6->Q Lbl 9 " " Dsz Q Goto 9 0->B~N 1->P Lbl 0 "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*_ \*\*\*\*\* Os andXs \*\*\*\*" 9F+3G+H->\r Prog "NXDRAW" 9I+3J+K->\r Prog "NXDRAW" 9L+3M+N->\r Prog "NXDRAW" Prog "NXCHK4WIN" \th=1=>Goto 1 B=9=>Goto 2 P=1=>"Player O (1(-)9)"?->\r P=2=>"Player X (1(-)9)"?->\r \r<1=>Goto 0 \r>9=>Goto 0 \r-1->\r Int (.5+3Frac (\r//3->E 6-3Int (\r/3->D F[D+E]<>0=>Goto 0 P->F[D+E] 3-P->P Isz B Goto 0 Lbl 1 P=2=>"\*\* Player O wins! \*\* " P=1=>"\*\* Player X wins! \*\* " Goto 3 Lbl 2 "\*\*\* It's a draw! \*\*\* " Lbl 3 " " @@ Prog "NXDRAW" \r>9=>Prog "NXD2" \r>9=>Goto 0 \r=1=>Goto 1 \r=2=>Goto 2 \r=3=>Goto 3 \r=4=>Goto 4 \r=5=>Goto 5 \r=6=>Goto 6 \r=7=>Goto 7 \r=8=>Goto 8 \r=9=>Goto 9 "# # #" Goto 0 Lbl 1 "# # O" Goto 0 Lbl 2 "# # X" Goto 0 Lbl 3 "# O #" Goto 0 Lbl 4 "# O O" Goto 0 Lbl 5 "# O X" Goto 0 Lbl 6 "# X #" Goto 0 Lbl 7 "# X O" Goto 0 Lbl 8 "# X X" Goto 0 Lbl 9 "O # #" Lbl 0 @@ Prog "NXD2" \r>18=>Prog "NXD3" \r>18=>Goto 0 \r=10=>Goto 1 \r=11=>Goto 2 \r=12=>Goto 3 \r=13=>Goto 4 \r=14=>Goto 5 \r=15=>Goto 6 \r=16=>Goto 7 \r=17=>Goto 8 \r=18=>Goto 9 Lbl 1 "O # O" Goto 0 Lbl 2 "O # X" Goto 0 Lbl 3 "O O #" Goto 0 Lbl 4 "O O O" Goto 0 Lbl 5 "O O X" Goto 0 Lbl 6 "O X #" Goto 0 Lbl 7 "O X O" Goto 0 Lbl 8 "O X X" Goto 0 Lbl 9 "X # #" Lbl 0 @@ Prog "NXD3" \r=19=>Goto 1 \r=20=>Goto 2 \r=21=>Goto 3 \r=22=>Goto 4 \r=23=>Goto 5 \r=24=>Goto 6 \r=25=>Goto 7 \r=26=>Goto 8 Lbl 1 "X # O" Goto 0 Lbl 2 "X # X" Goto 0 Lbl 3 "X O #" Goto 0 Lbl 4 "X O O" Goto 0 Lbl 5 "X O X" Goto 0 Lbl 6 "X X #" Goto 0 Lbl 7 "X X O" Goto 0 Lbl 8 "X X X" Lbl 0 @@ Prog "NXCHK4WIN" 1->\th F>0=>F=G=>G=H=>Goto 0 I>0=>I=J=>J=K=>Goto 0 L>0=>L=M=>M=N=>Goto 0 F>0=>F=I=>I=L=>Goto 0 G>0=>G=J=>J=M=>Goto 0 H>0=>H=K=>K=N=>Goto 0 F>0=>F=J=>J=N=>Goto 0 H>0=>H=J=>J=L=>Goto 0 0->\th Lbl 0