CODE BREAKER
Can you work out the colour sequence in this brain teaser by Roland Waddilove?
This is a game in which you have to crack a secret code.
The code consists of different colours and you can have twelve goes at it.
Pressing one of the numbered keys will place a colour, and DELETE will erase it.
A black peg means one of the colours is the right one and in the right place.
A white peg means one of the colours if the right one but in the wrong place.
Press the Space bar to start.
Variables | |
code() | Stores the secret code |
guess() | Stores your guess when you type it in |
marked_answer() | Stores whether a colour in the code has been marked or not |
marked_guess() | Stores whether a colour in your guess has been marked or not |
correct | TRUE if you have cracked the code |
guesses | The number of guesses made |
level | The difficulty level - the number of colours used |
i | Used as a counter in loops |
colour | The colour printed and placed in guess() |
keys | The key presses when asked if you want to play again |
Procedures |
|
PROCinitialise | Defines the characters used - a coloured circle, a white peg and a black peg. Sets up the arrays used, switches off the ESCAPE key and cursor keys, redefines the BREAK key |
PROCinstructions | Prints the instructions |
PROCset_variables | Sets the difficulty level |
PROCprint_board | Draws the gird, prints the title and colours used |
PROCset_code | Sets the secret code |
PROCinput_guess | Allows you to type in your guess. Only the colours up to and including level are allowed. As long as there is one colour present you can use DELETE. Guess() stores the colours. |
PROCcheck_guess | Marks the blacks first. Stores whether a colour in the answer or your guess has been marked or not. Leaves if all five colours are right. Marks the whites. A white peg is given only if neither the answer nor your guess has been marked before. |
PROCgot_it | Flashes the title and makes a sound. Calls PROCdisplay_answer to confirm that it is correct. |
PROCfailed | Prints FAILED, makes a low sound, calls PROCdisplay_answer to show what it was |
PROCanother_game | Asks if you want to play again |
PROCtidy_up | Restores the cursor keys and ESCAPE key |
PROCpause(delay) | Waits for the length of time the brackets |
MONEY MAZE
There's just a ghost of a chance you'll manage to whip round Roland Waddilove's MONEY MAZE without getting caught...!
Run through the maze, picking up as many coins as you can, but watch out for the three ghosts who will try to eat you!
If you manage to collect all the coins then the maze is filled again and the ghosts move faster.
Game Controls:
< - Left, > - Right, A - Up, Z - Down
Press SPACE to start.
Make sure the CAPS LK light is on.
Variables | |
maze$() | Stores each row of the maze |
ghost%() | Stores the ghost positions - x,y,x,y,x,y for the three ghosts |
gtime%() | The ghost is moved when gtime%() is less than TIME |
gdelay%() | The delay before each ghost is moved |
best% | Best score so far |
mtime% | When TIME is greater than mtime% the man can be moved |
mdelay% | The delay before the man can be moved |
manx%, many% | The man's x,y coordinates |
newx%, newy% | Temporary x,y coordinates for the man or ghost |
score% | Score |
caught | Whether the man has been caught or not |
n%, i | General variables, used in loops |
Procedures |
|
PROCinitialise | Defines the characters and the envelopes. Sets up the arrays, switches off the cursor keys and the ESCAPE key. Speeds up the auto repeat |
PROCinstructions | Prints a few notes about the program |
PROCdraw_maze | Draws the maze, looks at each character printed and selects the appropriate colour |
PROCset_variables | Sets the starting positions and initial delays for the man and ghosts |
PROCstart | Prints the man and ghosts. Sets the delay for the man and ghosts. Selects the colour for the maze |
PROCmove_man | Only if there is not a wall in the way. Checks if he has run into a ghost. Checks if he has picked up a coin. If it was the last one, calls PROCstart to start a new screen |
PROCmove_ghosts | If sufficient time has elapsed then moves the ghost by passing the parameters to PROCghost |
PROCghost | Finds out which way to move. Moves only if there is not a wall in the way. Checks to see if the man has been caught |
PROCanother_game | Makes a sound. Flashes GOT YOU at the bottom. If the score is the best so far then calls PROChi_score. Asks if you want to play again |
PROChi_score | Allows you to type in your name |
PROCtidy_up | Restores the auto-repeat, cursor keys and ESCAPE key |
Improvements/Modifications |
|
mdelay%, gdelay% | Alter these to change the speed of the game - the smaller they are the faster the initial speed. These decrease with each new maze. Alter the step with which they decrease each time. |