TIC TAC TOE
(Back)
Email the author:Paolo Bonzini
Usage: Enter a digit to make your move. Then the opponent (human too) takes its turn. The current status is shown in the upper-right corner: 0=empty, 1=nought, 2=cross, 7=dummy (sevens are only there to get the digits correctly aligned).
The program: 12=>dim(L1) fill(0,L1) {123,456,789,147,258,369,159,357,.1,.01,.001}=>L2 9=>M 1=>B Label IN ClrT Print L1(10) Print L1(11) Print L1(12) Print "123" Print "456" Print "789" Input A If L1(A)<>0 Goto IN B=>L1(A) (A-1)/3=>A L1(10+ipart A)+BL2(9+3fpart A)=>L1(10+ipart A) 1=>N Label CHECK L2(N)/100=>A L1(10fpart 10A)=>C CL1(ipart(10fpart A))=>C CL1(ipart A)=>C If C=BBB Goto WON 1+N=>N If N<9 Goto CHECK 3-B=>B M-1=>M If M>0 Goto IN Print "IT'S A DRAW!!" End Label WON Print "YOU WON!!"