' --------------------------- ' TIC TAC TOE ' --------------------------- winBox$ = "123 456 789 159 147 258 369 357" boxPos$ = "123 231 456 564 789 897 159 591 357 753 132 465 798 174 285 396 159 471 582 693 147 258 369 195 375" ai$ = "519628374" ox$ = "OX" [newGame] for i = 1 to 9 box$(i) = "" next i goto [shoTic] [loop] for j = 1 to 2 tic$ = mid$(ox$,j,1) for i = 1 to 25 b$ = word$(boxPos$,i," ") b1 = val(mid$(b$,1,1)) b2 = val(mid$(b$,2,1)) b3 = val(mid$(b$,3,1)) if box$(b1) = tic$ AND box$(b2) = tic$ AND box$(b3) = "" then box$(b3) = "O" goto [shoTic] end if next i next j if box$(1) = "O" AND box$(5) = "X" and box$(9) = "X" then if box$(3) = "" then box$(3) = "O" goto [shoTic] end if if box$(7) = "" then box$(7) = "O" goto [shoTic] end if end if for i = 1 to 9 b1 = val(mid$(ai$,i,1)) if box$(b1) = "" then box$(b1) = "O" exit for end if next i [shoTic] cls ' ---------------------------------------- ' show tic tac toe screen ' ---------------------------------------- html "
" if box$(i) <> "" then html box$(i) else button #box, " ";box$(i);" ", [doTic] #box setkey(str$(i)) end if if i mod 3 = 0 then html " |