On a computer with a very limited amount of memory (1K) even a simple game like Tic Tac Toe might be a problem to fit. This version of the well known game is short and simple, anyone will be able to understand it. Lines 10 through 90 define the variables A$ to I$ (since there are no string arrays on the ZX80 with 4K ROM, one must use another way). Lines 120 to 160 create the familiar tic tac toe pattern using the “checkerboard” graphics symbol (located above the “A” key—you must use the “shift key”). In order to save memory, this program assumes that you know the rules of tic tac toe, and therefore allows you to enter any number you want, only actually using those between one and nine. However, you may not put an X where there is already an O (or visa versa), the computer will just take the number and go on to let your opponent go. Those people with larger memory machines can adapt this program to include a “play against the computer” mode.

10 LET A$="1"
20 LET B$="2"
30 LET C$="3"
40 LET D$="4"
50 LET E$="5"
60 LET F$="6"
70 LET G$="7"
80 LET H$="8"
90 LET I$="9"
100 FOR Q=1 TO 9
110 PRINT " T I C T A C T O E"
120 PRINT A$;"▒";B$;"▒";C$
130 PRINT "▒▒▒▒▒▒▒▒▒" (9 ▒ symbols)
140 PRINT D$;"▒";E$;"▒";F$
150 PRINT "▒▒▒▒▒▒▒▒▒"
160 PRINT G$;"▒";H$;"▒";I$
170 PRINT
180 IF Q=2*(Q/2) THEN GO TO 230
190 PRINT "X GOES"
200 INPUT C
210 LET P$="X"
220 GO TO 270
230 PRINT
240 PRINT "O GOES"
250 INPUT C
260 LET P$="O"
270 LET J$=STR$(C)
280 IF J$=A$ AND NOT A$=P$ THEN A$=P$
290 IF J$=B$ AND NOT B$=P$ THEN B$=P$
300 IF J$=C$ AND NOT C$=P$ THEN C$=P$
310 IF J$=D$ AND NOT D$=P$ THEN D$=P$
320 IF J$=E$ AND NOT E$=P$ THEN E$=P$
330 IF J$=F$ AND NOT F$=P$ THEN F$=P$
340 IF J$=G$ AND NOT G$=P$ THEN G$=P$
350 IF J$=H$ AND NOT H$=P$ THEN H$=P$
360 IF J$=I$ AND NOT I$=P$ THEN I$=P$
370 IF A$=B$ AND B$=C$ THEN 470
380 IF A$=D$ AND D$=G$ THEN 470
390 IF A$=E$ AND E$=I$ THEN 470
400 IF B$=E$ AND E$=H$ THEN 470
410 IF C$=F$ AND F$=I$ THEN 470
420 IF D$=E$ AND E$=F$ THEN 470
430 IF G$=E$ AND E$=C$ THEN 470
440 IF G$=H$ AND H$=I$ THEN 470
450 NEXT Q
460 GO TO 490
470 PRINT P$;" WON"
480 GO TO 500
490 PRINT " T I E"
500 REM END
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.