Noughts and Crosses, by Tony Poulter.
From Your Computer, Feb 1982.

This has to be run on a 1K ZX81 (or with equivalent RAMTOP), it won't
work properly otherwise.

Transcript of notes:

"So far as I know, this is the first unbeatable noughts and crosses in
BASIC for the 1K ZX-81. An unbeatable program may not be thought an
interesting game but from a programming point of view, it is better.

Also, it has to be very economic. So it avoids numbers as far as
possible. GOTO CODE is used. Line 33 uses NOT S for zero, and line 44
uses SGN S for 1 and INT PI for 3.

The program displays a very small screen in lines 24 to 26. On each
move the choice is available either to press one of the characters on
the screen to enter a human's move there, or to press zero causing
the computer to move. Thus the program can be used five ways:

- As a notepad for two human players. Pressing zero is never used.

- As a game against the computer, pressing the player's move and zero
alternately.

- Let the computer start by pressing zero and human moves alternately.

- Press zero on every move - the computer plays itself.

- Enter the first few moves as the player's moves and then press zero
for the computer to make best move no matter what peculiar situation
you have set up.

When you press zero, the screen goes blank while the computer thinks.
The maximum time until the display returns is 12 seconds. As the
program does not stop anywhere, I need to explain what facilities
there are for dealing with the end of the game. First, when the
computer is waiting for a key to be pressed, the possible keys are 1,
2, 3, 5, 6, 7, 9, A, B, zero, full stop, and break. (Break is common
to all programs.) Any other key will have no effect. [Punctuation
altered above to make it clearer what was meant.]

Any key in the range 1 to B will have no effect if that place has
already been taken on the screen by X or O. Pressing zero will cause
the computer to think, then return with no effect if all the places
have been taken on the screen. There is no effect either if many
places have been taken and a draw is inevitable and also if a
completed line is present on the screen. You escape from these, and
any other situation you do not like, by pressing full stop, which
prints a new starting position.

If anyone wishes to amend the program they should note that the
constant P which is the address of the NEWLINE character starting the
display file less 28, has to be altered if the length of the program
is altered."