Program listing on 48K Spectrum.
Key showing in-game features. Labels refer to single player mode.
1 DIM t(91): INPUT "1-2?";f: READ n,t(41),t(42),t(50),t(51),t(1),z,p: DATA 23620,2,1,1,2,3,2,2: LET p=3-p: LET q=z>1: DIM c(3): FOR a=1 TO 8: FOR b=1 TO 8: LET k=t(a*9+b+1): PRINT AT 9,b;b;AT a,0;a;AT a,b; PAPER k+p*p*(a*9+b+1=z);" ": LET c(k+1)=c(k+1)+1: NEXT b: NEXT a: PRINT ''c(2);"x";c(3),: IF c(1)*c(p+1) THEN BORDER p: POKE (f<p)*n,20: INPUT a,b: FOR i=1 TO 62: LET z=CODE "!2j+qX=0-ol_D?ZB]HT\@[QAKOF/.nmVMYPG>^ULC9876fedcka4,ph;1:bg5!"(i)-32+(a*9+b)*(a*b>0)*(b<9): BEEP .01,i: FOR j=0 TO 9*(t(z)=0)-1: LET d=j+INT (j/3)*6-10: LET w=z+d: POKE (t(w)<>3-p)*n,32: LET w=w+d: POKE (t(w)<>p)*n,26: LET w=w-d: LET t(w)=p: POKE (w<>z)*n,29: NEXT j: POKE n,4+15*(2*(i*q<62)-(z>1=i))*(t(z)*j=0): NEXT i
Download the game
Einar later submitted a combined single and two player version of the game. This newly revised version was made possible to fit within the one-liner space due to many further clever optimisations by Dr BEEP. Thanks to Dr BEEP's space savings, enough additional features were able to be later added, eventually making this version far superior to the orginal game. The further space savings also allowed the BORDER colour to change during play to indicate the current player (blue or red) and a few other improvements. Finally, Dr BEEP was able to find yet more unexpected savings and this allowed for the addition of sound to the game.
The game mode (single player or two player) is selected by entering '1' or '2' at the initial 1-2? INPUT prompt. The below instructions were written when the game only supported single player mode and so are still relevant to that mode of play. For two player mode, the concepts are exactly the same, except that the second human player plays in place of the CPU.
To play the game, select a square to place a piece onto by inputting a pair of numbers into the computer, in the format ROW, COLUMN. The human player always moves first. A valid move is defined as one where your placed piece is immediatly adjacent to a contiguous block of one or more opponent's pieces, with another one of your pieces already situated at the other end of a straight line, so that two of your pieces "bridge over" the opponents pieces. On taking your move, all of the opponent's pieces that you have "bridged over" will flip over, and change into your pieces. If your selected move is invalid, then you will be returned to the INPUT prompt, so you can try again to enter a valid move without wasting your turn. It can happen in this game that there may not be a valid move available for you to play. In that case, simply enter your move as 0,0 and the computer will scan the board to confirm that you did not have a valid move, if so then you will PASS on that move. However, if you attempt a PASS, and there were valid moves available, then the computer will instead take the first valid move found on your behalf.
During the course of the game, play continues, alternating in turn between human and CPU until one of the end game conditions is met. The three endgame conditions are as follows:- (1) A player has had all of his pieces eliminated from the board (he loses the game), (2) The board is completely full (The player with the highest number of pieces on the board at this point wins the game), or (3) Neither player has a valid move remaining (Again, highest number of pieces wins). Also note, that during gameplay, the most recent move taken by either player is highlighted in a lighter colour than usual, so it is easy to stay aware of the last move made. Human player is blue (last move appears in cyan), CPU is red (last move appears in magenta).
The design of this game features some very clever concepts from Einar. The CPU AI is compressed down to a single string of 60 characters length, which lists the desired positions to hold on the board, in order of decreasing tactical importance. This seems at first sight to be quite simple, but in fact has proven able to beat the AI of three other othello games (two of them commercial releases). Another clever part is the algorthim to both validate and execute player moves, which was whittled down into a compact sequence of logical tests and conditional jumps, aided by the fact that underlying board data structure is a folded one-dimensional numeric array.
Back to Sinclair stuff index