Books Issue 2 Contents Issue 3

mind games



Teaching Sinclair noughts and crosses

Philip Joy describes how to make the ZX-81 learn from its mistakes.

HOW THE end game of chess as played by a computer has little skill involved was explained last month. Most tend to advance their pawns as top priority, which is satisfactory if the other player lets you do it; mostly, though, he will have you in checkmate while you are messing about. Now I am going to tell you how a computer can be made to learn its mistakes and so build its skill factor.

The game in question is Noughts and Crosses, which you may say, is a simple game. In fact it is, but if you have ever played a computer version of the game, it tends to be very easy to beat. That is because it is not a game of chance but simply of using the correct moves at the proper time, a game of total skill not counting the chance about where the opponent is going. It is that fact which can lead to a computer learning its mistakes, hence finding all the correct moves and hence having a perfect skill rating.

To make the computer learn its mistakes requires very little work. In simple terms, the computer, if it goes first, can go in one of nine squares to start, one of seven squares on the second move, and so on.

To see which square it should choose, we must look how a human player would make his move. One thing he would do is to look at the computer's move; that is the single most vital point affecting the square where you go. When we had seen what the computer had done, he would use his judgement to decide from past experience the best square. The word past is vital, because it is no use knowing what square the opponent has chosen if you do not know the correct response.

Therefore for each move the computer would have a list of moves for each move the player made. They can be produced at random at the start of the game. If a game is lost, the computer's last move is thrown out and a new move put in its place which has not been tried previously. If all the moves have been tried at that point, the move prior to that is altered. In that way the more games played the computer will show more skill, until it should be unbeatable.

This type of game can be put on any microcomputer with about 16K of memory; you might like to try it using your ZX-81. If you do, I would be interested to see it and I could include part of it in one of these pages.

Next month I hope to produce a listing of a game called Nim, an old game about piles of matches. Two players take it in turn to take some matches from one pile at a time. There could be nine piles, for example, with say six in each, or any other combination. There are usually restrictions on the number of matches a player can take, say one to three per move.

The game can be put on your 16K ZX-81 with no difficulty. In the meantime, you could try to produce such a game which you could compare to the one I have written.

Your ZX-81 is perfect for producing such mind puzzles as anagrams and missing number sums.

I hope you can send any mind games I have mentioned so I can include them. I would also like to see any games you have played against the ZX-81 chess programs, whether against yourself or computers.



Books Issue 2 Contents Issue 3

Sinclair User
May 1982