Turn Up - Adrian George (Your Spectrum-Issue 9-Page 81) Similar to the famous board game Othello ©, this program allows you to indulge in an amazing battle of wits with your Spectrum - and an extremely worthy opponent it makes too! If you don't know the rules of the game don't panic, a brief resume of the instructions for play follow. However, the only way you'll pick up the tactics of the game is by playing it ... and don't worry too much about making invalid moves because your opponent won't let you, as the program is very well error-trapped. The game is played on an eight-by-eight grid with each square allotted a co-ordinate defined by a letter (A to H) and a number (1 to 8); these are displayed at the sides of the grid. Play starts with two counters from each side (black counters belong to your opponent, the white ones are yours) placed diagonally in the centre of the grid. You can choose to go first if you want, and play begins by selecting a square's co-ordinates (letter first, then number) and if valid, you will be told how many of the Spectrum's counters you have 'captured' and asked if you still want to make the move. Answer 'Y' if it's OK; entering 'N' will give you the chance of making another move. The only valid moves are those that allow you to 'capture' a number of your opponent's counters. This is done by trapping one of your opponent's counters between two of your's in a straight line, be it horizontal, vertical or diagonal. Once you've trapped some counters, these are automatically converted to white pieces and it's the turn of the computer to try and capture some of your pieces. The game continues until every space on the grid has been taken or neither side can make a valid move. The winner is the one with the most counters still remaining on the board. Tactics are both complicated and difficult to explain; the best way of finding these out are to play a few games, lose gracefully and then get down to business. However, try and place your white pieces in the corners of the grid (which gives you control over the diagonals) and on the sides. At the start of the game, the grid is printed up on-screen and a prompt will come up when it's your turn to make a move. Type up the co-ordinates of the square you wish to move to and press Enter. If you enter an invalid move, you will be asked to have another go. Once a valid move is made, the computer will tell you how you stand to gain from the move and ask if you still want to go through with your decision. If you press 'Y', your move is made and the relevant counters are altered. The Spectrum will now think out which is the best move to make and once done, tells you its your go again. If at any time you can't make a valid move, press the 'M' key and your turn will be missed out. Check out lines 160-320 if you want to see how I've made the computer think for itself. I'm not sure it's the best way to do this, but you'll find the program's certainly hard to beat. However, I've only made the program check for one move ahead - so seasoned games players (and anyone else keen to exploit the program) are welcome to allow the Spectrum to look a few more moves ahead and thus make the program much harder to beat. It should be possible to make the Spectrum so good at the game that it never loses, but that doesn't seem all that much fun! Lines 10-20 Set the black INK and jump to subroutine which draws the screen display. Lines 30-120 This routine allows the player to input a move on-screen. Line 50 produces a BEEP - a noisy reminder that it's still your turn to input a move. Checks are made so that the first character you enter can only be a letter between 'A' and 'H' or an 'M' for a missed go. A check is also made to make sure the second character you enter is a number between one and eight. Lines 130-150 This area of the program GO SUBs to line 9000 - the routine to check that the move is valid; if the move is invalid, you will be told so on-screen. It the move turns out to be OK, the program GO SUBs to line 6000 to a routine which counts how many counters will be taken if the move is made. You are then asked if you still want to make the move. Pressing the 'N' key will give you the chance of another choice, and the 'Y' key moves the program on to line 8000 - the routine to flip over the required counters and update the score. Lines 160-220 The first of the routines that allow the Spectrum to make its move. To begin with, it looks at each square to check whether it's a valid move or not (line 9000) and then counts how many counters would be taken (line 6000). Lines 224-227 Once the valid moves have been checked out, the program here decides which is the most strategic position for its next move; corner and side squares are obviously worth more than those elsewhere. Lines 230-260 This routine examines each square, and if the 'position' value is more than or equal to the number of counters that can be taken, its co-ordinates are added to a list of possible moves. Lines 270-320 A square is chosen at random from the list of the best possible moves. lf the routine hasn't found any suitable moves, the Spectrum announces the fact that it can't go. Lines 6000-6100 This routine works out the number of counters which will be taken if a certain move is made. The array, b$, stores the board positions. Lines 7000-7070 This part of the program produces a flashy border to the screen, and prints the result of the game - either a win for the player, a draw or, in the case of the Spectrum winning, a typically arrogant announcement guaranteed to get you demanding another game. Lines 7080-7100 Ask if you would like to have another game. Lines 8000-8210 Make the moves happen on-screen, ie, the relevant counters are flipped over when required. Lines 8190 and 8200 update the score once a move has been completed. Lines 9000-9100 This routine checks if the square you wish to move to is valid within the rules of the game. Line 9000 checks to see if the square is already occupied, and lines 9010-9070 check that at least one of the opposition's counters is taken in the move. Lines 9500-9585 Print up the playing area on-screen. Lines 9590-9600 Set up the user-defined graphics used in the program. Lines 9610-9660 Contain the data for the user-defined graphics. ------------------------------------------------------------------------------ TYPE: Boardgame (Othello) 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