Flat Cube - Colin Young (Your Spectrum-No 3-Page 105)





This is one of those frustrating puzzles, in much the same vein 

as Rubik's Cube.

	At the start of play, you are presented with a blank 20 by 20 grid.

You have the choice of nine levels of difficulty, level one being 

the easiest and level nine being almost as bad as the original 

'cubist' problem. Once you have made your choice, the computer starts to

fill in areas of the board - by choosing one square at random,

inverting it, and then inverting its eight surrounding neighbours 

(ie. to the north, east, west and south, and the permutations in-

between). Consequently, if any of the blocks the computer is dealing

with is already inverted, then the overlapping portion is 

returned to normal. The number of inversions made is related to the level 

of play you indicate - which means if you pick level nine, you have

one heck of a mess on your hands!

	To play the game, you must type in the coordinates of the central

square of the nine block square you wish to invert. Screen coordinates

should be typed in with the letter denoting the column first

followed by the number of the row. (Don't worry too much about

getting it wrong though - it's been thoughtfully error-trapped 

for the unwary!) If you experiment a little, you will begin to see 

that, by cautiously re-arranging the grid, the overall screen can be 

returned to its original blank splendour; of course, you could always play 

the game the other way round and try to fill the complete grid with 

black squares, but you would have to re-write a lot of the published 

listing - not a task for the nervous at heart!

	A good tip for playing the game is to try and get all the 

inverted blocks towards the edge of the screen and then blast them out. 

Try having a go on the lowest level, just to get an idea of how the 

game operates, before attempting the more difficult stages. Luck is

definitely not the name of this game - but you'll need a good

deal of patience!





Lines 5-8       Set the Caps Lock and the 'number of goes' counter, and then

initialise the screen attributes.



Lines 10-21     Contain the subroutine to print the title page.



Lines 22-26     Check to see if instructions are required and, if so, jump

to the 'instructions' routine.



Lines 30-50     Draw the title page and prompt the user to input the

difficulty level required. The value input, di, is then multiplied by 10,

and this new value is the minimum number of goes needed to solve the puzzle.



Lines 70-90     Draw the blank playing grid, setting the screen flags to

show that there are no inverted characters on the screen. The playing area

is then set to play, with all the necessary character inversions for the

required level.



Lines 100-170   Main loop. This area of the program increases the 'number of

turns' counter, gets the users input and checks for its validity. Line 140

converts the user's input to x and y coordinates, and line 160 checks to see

if the puzzle has been completed.



Lines 1000-1050 Print the initial blank playing grid.



Lines 2000-2105 This long routine inverts the screen surrounding and

including the position you have chosen (x,y). Each square is inverted

individually. (This routine is not the best written we have seen - in fact,

it might be well worth your time employing a loop to try and shorten it.)



Lines 2110-3050 Contain the 'scramble' routine, used by the computer at the

start of each game to invert the nine-square blocks di times (di being the

value you input for the level of difficulty).



Lines 5000-5070 When the puzzle is completed, the 'completion' routine tells

you how many 'goes' it took you and offers you another game. You will also

get a message of congratulations - which on level nine, does your ego no end

of good!



Lines 5999-6110 Print out the instructions should you have requested them

(see lines 22-26).



------------------------------------------------------------------------------

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



