NOUGHTS AND CROSSES PROGRAM Written by David Green, Edinburgh University Shelved on 21 August 1993 This program was written by David Green as an MSc exercise when he was at Edinburgh University in 1991. The most interesting thing about it is its use of a 3x3 'magic square' to represent the playing area. This means that each position on the noughts & crosses board is given a numerical value: 8 3 4 1 5 9 6 7 2 It is a property of this magic square that each winning line in noughts & crosses has a total sum of 15. Thereore, 15 as a sum of three numbers uniquely defines a particular winning position of the game. The game state is stored as a list of the numbers which have been 'taken' so far by the user, a list of the numbers which have similarly been taken by the computer, and finally a list representing the current board state, in which positions which have previously been filled by either player are marked with an 'o' or an 'x' as is appropriate. Furthermore, this representation makes it possible to refer to any vacant board position by a single number from 1 to 9. SIZE: 18 kilobytes. CHECKED ON EDINBURGH-COMPATIBLE (POPLOG) PROLOG : no. PORTABILITY : looks pretty good. INTERNAL DOCUMENTATION : Predicates are commented with a statement of their purpose.