ROYAL WEDDING PUZZLE
By Gordon Key and David McLachlan
To celebrate the Royal Wedding, we've come up with a real teaser - a sliding block puzzle based on the happy occasion.
When you run the program you will be offered a choice of four inbuilt pictures on the wedding theme or of loading a pre-recorded Mode 2 screen of your own. You will then be presented with the complete picture.
Once you've studied it, shuffle the picture by pressing Space and attempt to solve the resultant jumble. The keys you'll need to sort it all out are:
Z - Move tile to left |
X - Move rile to right |
: - Move tile up |
? - Move tile down |
Space can be pressed at any time to further shuffle the tiles. Should you give up, pressing RETURN will undo all your moves and any entered by SPACE, and the puzzle will be solved for you in a few seconds provided less than 2,000 moves have been made.
Pressing ESCAPE at any time will return you to the menu so that you can select another picture.
The program's operation is quite simple. Two short machine code routines are assembled at &110 and &900.
The first is used to move a block or tile by accessing the screen directly, and the second prints large letters.
The screen is split into 16 equally sized tiles which are numbered from 0 to 15.
Two integer variables, N% and O%, are then used to pass the new and old tile numbers to the assembly routine via the CALL statement using the parameter block provided in page six by Basic.
The routine also transfers the contents of the first variable to the second.
Each time a tile is moved - including random moves generated by pressing Space - the move is recorded by PROCsave. This stores four moves in a single byte of memory starting at &A00.
Due to this efficient method of storage almost 2000 moves can be safely stored.
Pressing RETURN solves the program by simply reversing all moves until the picture is restored.
If the computer beeps while you are playing, it means that the available storage memory is full and you have two options.
You can either press RETURN to solve the puzzle, or press C to continue, but note that RETURN will no longer solve the puzzle as the counter (H%) is zeroed.
If you select option 5 in order to load your own Mode 2 picture this should have been previously saved to tape or disc using the command *SAVE filename 3000 +5000.
On selecting this option you are given the choice of entering a filename or a star command.
This facility is useful for cataloguing tape or disc, changing drives and so on, though take care as some commands could destroy the program (selecting another language for example).
If a disc error occurs this will be displayed for a short period before you are returned to the menu.
When saving your own screen, it is advisable to set up a window using VDU 28,0,31,4,25.
Although this makes reading a little difficult, anything that you type or the computer outputs will print on the part of the screen where the missing tile starts and not destroy your picture.
You should note that due to the length of the program several sections are deleted after use before the main program is run.
It is therefore essential that you do not add any extra spaces as you type it in and save the program before running it.
Also the program is downloaded to &1100 if page is higher. This still allows users of most types of DFS to load their Mode 2 screens. Unfortunately this does not apply to the ADFS, which cannot be used after a download.
The following function keys are defined and called from within the program:
f0 | Downloads the program is necessary |
f1 | Deletes all the assembler code |
f2 | Deletes the instructions |
Procedures | |
play | The main game repeat loop. Repeats indefinitely until ESCAPE is pressed |
move | If A% is TRUE this procedure makes the souvenir balloon picture move by redefining the actual colour displayed by colour numbers 1 through 12 |
get | Gets keyboard input and returns the new title number (N%) |
del(D%) | A delay procedure that runs independently of TIME |
save(h%) | Records each move whether entered from the keyboard or generated by PROCshuffle. Each move is stored as a two bit number thus enabling four moves to be stored per byte |
solve(D%) | Solves the puzzle by reversing all moves until the picture is restored |
shuffle | Randomly shuffles the picture tiles |
c() | Draws a circle controlled by the numerous parameters |
grid(gc%) | Draws the grid in the colour gc% that separates the 16 picture titles and sets the initial values for the puzzle |
title | Sets the initial program variables and runs the title sequence |
writeword() | Writes word$ in big letters at x%,y% |
f(X%,Y%,C%) | Fills an area from X%,Y% in the colour C% |
inst | Prints the menu of options, gets the one required and returns a string that tallies with the appropriate picture function |
dim | Dimensions and sets the values of the SIN and COSIN arrays used by PROCs |
big(A$,X%,Y%,c%) | Prints A$ at X%,Y% in colour c% and in double height characters |
code | The assembly language procedure for moving the tiles |
code2 | The assembly language for the big letters routine |
SNAP DRAGON
By Philip Ord and Keith Owens
SNAP DRAGON, a card game based on that old favourite Snap, is full of fun and excitement for youngsters.
The cards are placed one by one on the table. When the top two cards match, hit your key before your opponent can press his.
If you beat him the door to your pet dragon's cave is raised a little. If you're not quick enough your opponent gains the advantage instead.
After winning several times the door will be high enough for one of the dragons to emerge. He'll race out and destroy the opposing player.
Are your reactions fast enough to avoid the fiery fate that awaits you?
The keys are Z for player 1 and / for player 2.
The program is fairly long for a Mode 1 game, so leave out all unnecessary spaces when entering the listing or you'll run out of memory. The space following the line number isn't needed so miss it out.
Main Variables | |
X1%,Y1% | Player 1's lift coordinates |
X2%,Y2% | Player 2's lift coordinates |
X%,Y% | Graphics window coordinates for card background, colour |
GC | Court card colours |
C | Card value |
SUIT | Card suit |
da% | Card counter |
D1%,D2% | Dragon's cave coordinates |
Procedures |
|
setup | Inputs players' names and sets up screen |
chars | Defines characters and deletes flashing cursor |
init | Sets initial values for all variables used |
select_card | Uses information from PROCdata to select card and suit. Also defines correct colours |
shuffle | Shuffles the deck after 52 cards |
key | Tests for keypress and acts accordingly |
snap1 | If keypress is valid, moves lift of player 1 and enlarges left hand cave entrance |
snap2 | Moves lift of player 2 and enlarges right hand cave entrance |
invalid | If cards do not match when key is pressed a warning message is printed |
display | Creates random colour and sound display |
win | Congratulates winner and offers a new game |
data | Generates a random number between 1 and 52 inclusive to produce from the data statements, a different card and suit value |
THE ATTRIBUTES TRAIL
By Rog Frost
THE ATTRIBUTES TRAIL is a two player game in which you and your opponent score points by matching colours and shapes.
You move from square to square on a grid, trying to keep on the same shape or colour.
The game is educational fun for children aged five and over, and is also a brain teaser for adults.
Young children will only be looking one move ahead, but they will be learning about left, right, up and down, as well as shape and colour.
Cannier games players will work out some strategy, but as each square can only be visited once beware of getting blocked in.
You can increase the difficulty of the game either by reducing the time available for each move or by making it illegal to move to a square of the same colour as your opponent's. These options are given in the game.
A feature of the program is the input routine for players' names. Instead of plain INPUT the letters in the name are taken one at a time and amended so that the name appears as a child would write it - first letter in upper case, remaining letters lower case.
The routine also detects spaces and full stops and puts the next letter in upper case.
At the end of the game the faces of the players are drawn with names and scores underneath.
Variables | |
col%(63) | Colour in each square |
shape%(63) | Shape in each square |
name$(2) | Players' names |
move% | Number of goes taken |
direction$ | Player's requested move |
wait% | Time permitted for each move |
Procedures |
|
init | Defines characters and variables |
instruct | Prints instructions |
grid | Sets up the screen |
delay | A short pause |
end | Draws the faces at the end |