By Paul Lay


Issue 25

Jan/Feb 87

Next Article >>

<< Prev Article



Requires ST BASIC
Runs in low resolution only

This is a version of the popular board game Othello. You play against the computer using the mouse to select your moves. The player always plays with white counters and the computer with black and each take alternate turns in placing one of their counters on the board. A counter must be placed so that it and another of the player's counters trap an unbroken line of the opposing counters either up, down, left, right or diagonally. Any runs which are trapped are then flipped over to the opposite colour. Once the board is completely filled the game ends and the winner is whoever has the most counters on the board. If at any time a counter cannot be placed on the board, then the game is aborted.


The program is written in ST BASIC. On running the program you will be presented with a title screen on which there are two choices 'Player Starts' and 'Computer Starts'. You can begin the game by clicking on either of these with the mouse. When the game begins the board will be drawn together with a message window and an abort option. The message window displays whose turn it is and also displays the scores at the end of the game. Clicking the abort option will enable the player to abort the game on his turn, useful if you can't make a move or you are getting thrashed!

On the player's turn, clicking a square on the board will cause an attempt to place a player's piece in that square. A counter may only be placed if the square is empty and causes a run of the opposing counters to be flipped. If, on the computer's turn, no move is possible, then a message is displayed and the game aborted.


One interesting point which arose during the writing of the program was that, if the desktop accessories were booted up with BASIC, then these actually alter some of the colour registers. In order to overcome this problem the colour registers should be set from within the program. This is done by the following code:

poke contrl,14: poke contrl + 2,0: poke contrl + 6,4
poke intin,cr
poke intin + 2,143*r: poke intin + 4,143*g:poke intin + 6,143*b

where cr is the colour register (0 to 15) and r, g, b are the intensities of red, green and blue respectively in the range 0 to 7. Refer to the code starting at line 1410 for an example.

STLister - requires Java