--- title: "Tic Tac Toe (Syntax)" id: 76649 type: "computer_media" slug: "tic-tac-toe-syntax" url: "http://localhost/computer_media/tic-tac-toe-syntax/" markdown_url: "http://localhost/computer_media/tic-tac-toe-syntax.md" published_at: "2026-11-11T08:02:17+00:00" modified_at: "2026-11-11T08:02:17+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/tic-tac-toe-syntax-1.png" excerpt: "Noughts and crosses against the ZX80." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "ZX80" slug: "zx80" taxonomy: "post_tag" url: "http://localhost/tag/zx80/" model: - name: "Sinclair ZX80" slug: "zx80" taxonomy: "model" url: "http://localhost/model/zx80/" indiv: - name: "Raymond Fowkes" slug: "raymond-fowkes" taxonomy: "indiv" url: "http://localhost/indiv/raymond-fowkes/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_type: "Program" programmers: - name: "Raymond Fowkes" slug: "raymond-fowkes" taxonomy: "indiv" url: "http://localhost/indiv/raymond-fowkes/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Tic%20Tac%20Toe%20%28Syntax%29%20%281982%29%28Fowkes%2C%20Raymond%29%28ZX80%29%28US%29%28Program%29.zip" mediadate: "1982" images: - url: "http://localhost/wp-content/uploads/2026/11/tic-tac-toe-syntax-1.png" - url: "http://localhost/wp-content/uploads/2026/11/tic-tac-toe-syntax-2.png" - url: "http://localhost/wp-content/uploads/2026/11/tic-tac-toe-syntax-3.png" article_media: - id: 65589 title: "Tic Tac Toe — 4K/2K" type: "article" url: "http://localhost/article/tic-tac-toe-4k-2k/" media_type_tags: "Game" license: false --- # Tic Tac Toe (Syntax) Noughts and crosses against the ZX80. Choose whether to go first (an answer starting with Y means yes), then enter the number of a square, 1-9, on the numbered grid. The computer marks its own square after each of yours; its first two moves come from lines 650-750 and the rest are forced or random. At the end it says who won and offers another game. Needs the 4K ROM and at least 2K RAM. Lines 180-210 draw the grid with graphic characters, which SYNTAX printed as key descriptions (3 spaces, shift Q, and so on). Published in Syntax July 1982 ([Tic Tac Toe — 4K/2K](https://timexsinclair.com/article/tic-tac-toe-4k-2k/)). ## Source Code ``` 10 CLS 20 PRINT ,"TIC TAC TOE" 30 PRINT 40 PRINT "DO YOU WANT TO GO FIRST?" 50 INPUT A$ 60 LET Q=CODE(A$)=62 70 CLS 80 PRINT ,"TIC TAC TOE" 90 PRINT 100 PRINT 110 LET X=1 120 GO SUB 180 130 GO SUB 210 140 GO SUB 180 150 GO SUB 210 160 GO SUB 180 170 GO TO 240 180 PRINT ," ▌ ▌ " 190 PRINT ," ";X;" ▌";X+1;" ▌";X+2;" " 200 RETURN 210 PRINT ,"▗▄▄";CHR$(133);"▄▄";CHR$(133);"▄▄" 220 LET X=X+3 230 RETURN 240 RANDOMISE 250 LET A=0 260 LET C=-1 270 LET P=-1 280 DIM C(4) 290 DIM P(4) 300 IF Q THEN GO TO 860 310 LET Y=RND(5)*2-1 320 GO TO 780 330 IF C<1 THEN GO TO 530 340 FOR B=0 TO C 350 FOR D=0 TO C 360 LET X=C(D) 370 LET Y=C(B) 380 GO SUB 1030 390 IF Z THEN GO TO 510 400 GO SUB 1050 410 GO SUB 1070 420 IF PEEK(A)THEN GO TO 510 430 GO SUB 1190 440 PRINT 450 PRINT "--I WON--" 460 PRINT 470 PRINT "PLAY AGAIN?" 480 INPUT A$ 490 IF CODE(A$)=62 THEN RUN 500 LIST 510 NEXT D 520 NEXT B 530 FOR B=0 TO P 540 FOR D=0 TO P 550 LET X=P(D) 560 LET Y=P(B) 570 GO SUB 1030 580 IF Z THEN GO TO 630 590 GO SUB 1050 600 GO SUB 1070 610 IF PEEK(A) THEN GO TO 630 620 GO TO 820 630 NEXT D 640 NEXT B 650 IF C>-1 THEN GO TO 680 660 LET Y=5-2*(P(0)=5) 670 GO TO 780 680 IF C>0 THEN GO TO 770 690 IF NOT Q THEN GO TO 730 700 LET Y=1 710 IF E=1 OR E=6 OR E=8 OR P(0)=6 OR P(0)=8 THEN LET Y=9 715 IF ABS (E-P(0))=8 OR (E AND P(0))=3 THEN LET Y=RND(4)*2 720 GO TO 780 730 LET Y=10-C(0) 740 IF (E/2)*2=E OR E=10-C(C) THEN LET Y=5 750 IF C(0)=5 THEN LET Y=9+(E=9)*2 760 GO TO 780 770 LET Y=RND(9) 780 GO SUB 1050 790 LET Z=Y 800 GO SUB 1240 810 IF PEEK(A) THEN GO TO 770 820 GO SUB 1190 830 LET C=C+1 840 IF C>3 THEN GO TO 1000 850 LET C(C)=(Z-29-(Z/70)*45)/3 860 INPUT E 870 IF E<1 OR E>9 THEN GO TO 860 880 LET Y=E 890 GO SUB 1050 900 LET Z=Y 910 GO SUB 1240 920 IF PEEK(A) THEN GO TO 860 930 POKE A,6 940 POKE A+1,6 950 POKE A+18,8 960 POKE A+19,6 970 LET P=P+1 980 LET P(P)=E 990 IF P<4 THEN GO TO 330 1000 PRINT 1010 PRINT "--TIE GAME--" 1020 GO TO 460 1030 LET Z=( NOT X5))*2 OR (X/2)*2=X AND (Y=5-X/2 OR Y=10-X/2)) 1040 RETURN 1050 LET Y=Y*3+29+((Y-1)/3)*45 1060 RETURN 1070 LET X=X*3+29+((X-1)/3)*45 1080 LET Z=2*Y-X 1090 GO SUB 1170 1100 IF A THEN GO TO 1150 1110 LET Z=2*X-Y 1120 GO SUB 1170 1130 IF A THEN GO TO 1150 1140 LET Z=(X+Y)/2 1150 GO SUB 1240 1160 RETURN 1170 LET A=(Z=32 OR Z=35 OR Z=38 OR Z=86 OR Z=89 OR Z=92 OR Z=140 OR Z=143 OR Z=146) 1180 RETURN 1190 POKE A,3 1200 POKE A+1,6 1210 POKE A+18,133 1220 POKE A+19,2 1230 RETURN 1240 LET A=PEEK(16396)+PEEK(16397)*256+Z 1250 RETURN ```