Noughts & Crosses - Mark Burton (Your Spectrum-No.4-Page 83) Remember how frustrating it was getting endless draws playing the conventional three-by-three classroom game of Noughts and Crosses? Well, in this program for the 48K Spectrum, you'll be lucky to get a draw, let alone beat the system. When you first run the program, a message pops up across the top of the screen offering you the option of checking out the instructions - always a useful feature for the first time user. The rules are very easy to follow; you simply input numbers relating to the row, level and column (in that order) and press the Enter key. Once you've inwardly digested the instructions, pressing any key will thrust you into the action. The four playing grids will be drawn on-screen, each comprising of four-by-four squares, one on top of the other, and each with a numbered label to mark its coordinates. After a pause of about 10 seconds while the computer sets up the necessary variables and flags, you'll be asked whether or not you want to start first. Decision made, it's time to begin. The principle of the game is as old as the hills, so explanation of play will be kept to a minimum. All you have to do is to get four 'X' characters in a row, be they in a horizontal, vertical or diagonal row. But keep an eye on the cunning Speccy to make sure it doesn't get four 'O' characters in a row first. Once a row of four similar characters has been achieved, a message of congratulations or otherwise will be displayed on- screen. You'll then be asked if you'd like another crack at it - remember, revenge is sweet! Should you input too many characters or make some other silly error, not to worry - the listing is well error-trapped. And that's it really, no less frustrating than the original - just a bit more challenging. Lines 1-4 Ask if instructions for playing the game are required. If so, the program jumps to the 'instruction' routine at line 9600. Lines 5-9 Draw and label the four-by-four-by-four playing grid. Line 10 Set up the necessary variables and flags. Array A$ holds the current state of the board. Lines 20-250 Set up the array F$ to contain the 'move priority' table and place the current state of play in A$. Lines 260-310 Check of the user wants to have the first move. If so, the program jumps to line 1000; otherwise, it jumps to line 1200. Lines 400-430 Check if the space you wish to place a character is already occupied. If it is, a message is printed and the program jumps to the 'input move' routine at line 1000. Lines 1000-1080 Get the player's move and check that the space is not already occupied (via the routine at lines 400-430). The coordinates are input in order (level, row and column) and are assigned to the variables C, D and E respectively. Lines 1090-1130 Place the player's move into the array A$. K$ is the flag used to check whether it's the player's turn to move or the computer's. Lines 1140-1195 The player has managed to put one over on the Speccy. You are given a message of congratulation and asked if you'd like to play another game. Mood music accompanies this momentous decision. Lines 1200-1770 Hold the logic which checks whether someone has won the game. If it's the computer, a message offering you commiserations appears. The program then jumps to the routine asking if you'd like another game. Lines 1800-1810 If you manage to hold off the Speccy to a draw, these lines give you a relevant on-screen message and jump to the routine at line 1150 offering you another chance for your revenge. Lines 6000-6800 Hold the logic to instruct the Speccy in the finer arts of Noughts and Crosses. You'll find it a mean opponent! Lines 7000-7435 This is the data controlling the player's move. Lines 9000-9480 Calculate the plot position for each of the moves made in the game. Lines 9500-9520 Plot an 'X' or 'O' in the position calculated by the routine in lines 9000-9480, depending on the value in K$ (ie. whose turn it is). Lines 9600-9670 Print the instructions for the first-time user. ------------------------------------------------------------------------------ TYPE: Boardgame COMMENT: This info file was typed by Jim Grimwood Downloaded from: Desert Island Disks -- http://www.image.dk/~frankie/ Maintained by: Michael Bruhn -- frankie@image.dk