--- title: "Tic Tac Toe (CATS)" id: 73018 type: "computer_media" slug: "tic-tac-toe-cats" url: "http://localhost/computer_media/tic-tac-toe-cats/" markdown_url: "http://localhost/computer_media/tic-tac-toe-cats.md" published_at: "2026-10-27T21:30:33+00:00" modified_at: "2026-10-27T21:30:33+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Tic-tac-toe against the computer, where you set the probability that the computer plays its best move and the number of games in a match." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_contents: - id: 51212 title: "CATS Library Tape 1" type: "computer_media" url: "http://localhost/computer_media/cats-library-tape-1/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/CATS%20Library%20Tape%201%20%28198x%29%28Capital%20Area%20Timex%20Sinclair%20Users%20Group%29%28TS2068%29%28US%29%28Program%29.zip" tsrun_member: "CATS Library Tape 1 (198x)(Capital Area Timex Sinclair Users Group)(TS2068)(US)(Program)/tictactoe.tap" mediadate: "198x" related_content: - id: 51212 title: "CATS Library Tape 1" type: "computer_media" url: "http://localhost/computer_media/cats-library-tape-1/" - id: 53816 title: "Tic Tac Toe" type: "computer_media" url: "http://localhost/computer_media/tic-tac-toe/" media_type_tags: "Game" license: false --- # Tic Tac Toe (CATS) A tic-tac-toe game against the computer. Before the match you enter the probability of winning you want the computer to play with (0 = never, 1 = always, or anything in between) and the number of games. The board is drawn with PLOT, the squares are numbered 1 to 9, and you choose a square by number. Each game ends with “COMPUTER WINS”, “YOU WIN” or “CATS GAME” (a draw), and the running score of player and computer games is shown. It is on CATS Library Tape 1 of the Capital Area Timex Sinclair Users Group, and on the CATS library disks for the Zebra disk drive; both copies list the same. Its only REM is “TTT”; no author is named. It is a different program from the SINCUS Tic Tac Toe. ## Program Analysis Who moves first is chosen at random with `INT (2*RND)` and a computed `GO TO (64+T*12)`. On each computer turn, `IF RND0 THEN GO TO 106 103 LET N=(4-ABS (5-NL))+NL 104 GO TO 500 106 LET N=5 108 GO TO 500 110 LET N=10-NLL 112 IF NL=5 THEN GO TO 500 114 LET N=NLL+6-12*INT (.2*NLL) 116 IF D(N)<>0 THEN LET N=10-N 118 GO TO 500 120 LET N=5 121 IF D(5)=0 THEN GO TO 500 122 LET EN=2 123 GO TO 600 124 LET EN=0 125 IF DA<>15 THEN GO TO 700 126 LET N=2*INT (1+4*RND) 127 IF DT=-5 THEN GO TO 500 128 GO TO 700 400 FOR J=1 TO 9 410 LET D(J)=0 420 NEXT J 430 RETURN 500 LET D(N)=2*T-1 502 LET EN=1 503 GO SUB 800 504 IF P>=4 THEN GO TO 600 506 LET P=P+1 508 LET NLL=NL 510 LET NL=N 512 IF (P>=10) THEN GO TO 520 514 LET T=ABS (T-1) 516 GO TO 62 520 PRINT AT 19,4;"CATS GAME" 524 GO TO 575 560 PRINT AT 19,4;"COMPUTER WINS " 562 LET CS=CS+1 564 GO TO 575 570 PRINT AT 19,4;"YOU WIN " 572 LET PS=PS+1 575 PAUSE 600 576 CLS 590 IF G=5 THEN LET RX=0 714 NEXT M 716 FOR N=2 TO 8 STEP 2 718 IF D(N)=0 THEN GO TO 500 720 NEXT N 722 LET N=5 724 GO TO 500 800 LET Y=(N+2)/3 802 LET R=3+4*INT (Y) 804 LET C=12*(1.01+Y-INT (Y)) 806 LET A$="X" 808 IF T=1 THEN LET A$="O" 810 PRINT AT R,C;A$ 812 RETURN 900 PRINT AT 7,12;"1 2 3" 910 PRINT AT 11,12;"4 5 6" 920 PRINT AT 15,12;"7 8 9" 940 FOR j=40 TO 128 950 PLOT 146,j 960 PLOT 114,j 970 NEXT J 980 FOR j=80 TO 176 982 PLOT j,100 984 PLOT j,68 986 NEXT J 988 RETURN 9000 SAVE "ttt" LINE 40 ```