\START85\ \COMMENT=Program file dated 01/10/96, 18:19 \NAME=TicTac \FILE=TICTAC.85P :.3\->\I :0\->\Q :{3,3}\->\dim A :Fill(0,A) :{3,3}\->\dim B :Fill(0,B) :1\->\W :Goto S :Lbl HUMAN :2\->\W :Input "(Row,Col): ",M :real M\->\R :imag M\->\C :R\->\S :C\->\T :If A(R,C)==0 and B(R,C)==0 :Then :1\->\A(R,C) :Goto S :Else :Goto HUMAN :End :Lbl COMP :rand\->\F :1\->\W :If B(1,1)+B(2,2)+B(3,3)==2 :Then :For(C,1,3) :If A(C,C)==0 and B(C,C)==0 :Then :1\->\B(C,C) :Goto S :End :End :End :If B(1,3)+B(2,2)+B(3,1)==2 :Then :For(C,1,3) :If A(C,4-C)==0 and B(C,4-C)==0 :Then :1\->\B(C,4-C) :Goto S :End :End :End :If cnorm B==2 :Then :For(C,1,3) :If B(1,C)+B(2,C)+B(3,C)==2 :Then :For(R,1,3) :If A(R,C)==0 and B(R,C)==0 :Then :1\->\B(R,C) :Goto S :End :End :End :End :End :If rnorm B==2 :Then :For(R,1,3) :If B(R,1)+B(R,2)+B(R,3)==2 :Then :For(C,1,3) :If A(R,C)==0 and B(R,C)==0 :Then :1\->\B(R,C) :Goto S :End :End :End :End :End :If A(1,1)+A(2,2)+A(3,3)==2 :Then :For(C,1,3) :If A(C,C)==0 and B(C,C)==0 :Then :1\->\B(C,C) :Goto S :End :If A(C,C)==0 and B(C,C)==1 and C\<>\2 and F>(.7I) and A(4-C,C)==0 and \#\ B(4-C,C)==0 and rnorm A<2 and cnorm A<2 :Then :1\->\B(4-C,C) :Goto S :End :End :End :If A(1,3)+A(2,2)+A(3,1)==2 :Then :For(C,1,3) :If A(C,4-C)==0 and B(C,4-C)==0 :Then :1\->\B(C,4-C) :Goto S :End :If A(C,4-C)==0 and B(C,4-C)==1 and C\<>\2 and F>(.7I) and A(4-C,4-C)==\#\ 0 and B(4-C,4-C)==0 and rnorm A<2 and cnorm A<2 :Then :1\->\B(4-C,4-C) :Goto S :End :End :End :If norm A==1 and S==2 and T==2 and F>(.7I) :Then :2(round(rand,0))+1\->\J :2(round(rand,0))+1\->\K :1\->\B(J,K) :Goto S :End :If cnorm A==2 :Then :For(C,1,3) :If A(1,C)+A(2,C)+A(3,C)==2 :Then :For(R,1,3) :If A(R,C)==0 and B(R,C)==0 :Then :1\->\B(R,C) :Goto S :End :End :End :End :End :If rnorm A==2 :Then :For(R,1,3) :If A(R,1)+A(R,2)+A(R,3)==2 :Then :For(C,1,3) :If A(R,C)==0 and B(R,C)==0 :Then :1\->\B(R,C) :Goto S :End :End :End :End :End :If S==2 and A(1,T)==0 and B(1,T)==0 and T\<>\2 and F>I and Q==0 :Then :1\->\B(1,T) :1\->\Q :Goto S :End :If S==2 and A(3,T)==0 and B(3,T)==0 and T\<>\2 and F>I and Q==0 :Then :1\->\B(3,T) :1\->\Q :Goto S :End :If T==2 and A(S,1)==0 and B(S,1)==0 and S\<>\2 and F>I and Q==0 :Then :1\->\B(S,1) :1\->\Q :Goto S :End :If T==2 and A(S,3)==0 and B(S,3)==0 and S\<>\2 and F>I and Q==0 :Then :1\->\B(S,3) :1\->\Q :Goto S :End :If A(2,2)==0 and B(2,2)==0 and F>(.5I) :Then :1\->\B(2,2) :Goto S :End :If A(S,2)==0 and B(S,2)==0 and F>(.5I) :Then :1\->\B(S,2) :Goto S :End :If A(S,2)==0 and B(S,2)==0 and F>I :Then :1\->\B(S,2) :Goto S :End :Lbl K :iPart (3rand)+1\->\R :iPart (3rand)+1\->\C :If A(R,C)==0 and B(R,C)==0 :Then :1\->\B(R,C) :Goto S :Else :Goto K :End :End :Lbl S :ClLCD :Outpt(3,7,"| |") :Outpt(4,4,"---+-----+---") :Outpt(5,7,"| |") :Outpt(6,4,"---+-----+---") :Outpt(7,7,"| |") :For(R,1,3) :For(C,1,3) :If A(R,C)==1 :Outpt(2*R+1,5*C,"X") :If B(R,C)==1 :Outpt(2*R+1,5*C,"O") :End :End :If rnorm A==3 or cnorm A==3 or (A(1,1)+A(2,2)+A(3,3))==3 or (A(1,3)+A(\#\ 2,2)+A(3,1))==3 :Then :Disp "You Win!" :Stop :End :If rnorm B==3 or cnorm B==3 or (B(1,1)+B(2,2)+B(3,3))==3 or (B(1,3)+B(\#\ 2,2)+B(3,1))==3 :Then :Disp "TI-85 Wins." :Stop :End :If ((norm A)\^2\+(norm B)\^2\)==9 :Stop :If W==1 :Goto HUMAN :If W==2 :Goto COMP \STOP85\