

P.R. SCOTT has sent the kind of program Mr. Spock plays on long, winter evenings. 3D Tic Tac Toe displays a cube and 27 possible positions for the Xs and Os. Unlike the 2D version, the game must be continued until all the positions are filled, the object being not to obtain the first completed row but as many as possible.
The player who starts has an advantage, as finally he occupies one space more than his opponent and so, to level matters, the first player is prevented from occupying the center square on his first attempt.
The program checks for that and other illegal moves, as well as setting-up the board, indicating whose turn is next, and giving the correct score throughout. Moves are entered by keying-in a letter, then a number, then ENTER. “A” indicates the front face of the cube, “B” the center and “C” the rear. Entering “R” will restart the game (T/S1000,ZX81, 16K).
5 DIM A(27)
10 DIM C(18)
15 DIM R(18)
20 DIM X(27)
30 LET X$ = "0208140208140208140612180612180612181016"+
"22101622101622"
35 LET Y$ = "0606061212121818180404041010101616160202"+
"02080808141414"
40 FOR Z=1 TO 27
45 LET X(Z) = VAL X$(2*Z-1 TO 2*Z)
50 LET Y(Z) = VAL Y$(2*Z-1 TO 2*Z)
55 NEXT Z
60 LET C$="020405050505060810111111111213131313"
65 LET R$="010301020304030109010809100903060912"
70 FOR Z=1 TO 18
75 LET C(Z)=VAL C$(2*Z-1 TO 2*Z)
80 LET R(Z)=VAL R$(2*Z-1 TO 2*Z)
90 NEXT Z
100 FOR Z=1 TO 27
105 LET A(Z)=0
110 NEXT Z
115 LET S=1
120 LET N=1
170 CLS
175 GOSUB 1000
180 IF S=1 THEN PRINT AT 2,0;"""X"" TO GO"
185 IF S=-1 THEN PRINT AT 2,0;"""O"" TO GO"
190 PRINT AT 20,14;" "
200 INPUT Z$
205 IF N=28 THEN GOTO 100
210 IF Z$(1)="R" THEN GOTO 100
215 IF Z$(1)="A" THEN LET Z=0
220 IF Z$(1)="B" THEN LET Z=9
225 IF Z$(1)="C" THEN LET Z=18
235 LET Z=Z+ VAL Z$(2)
240 IF A(Z) <> 0 THEN GOTO 390
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.