EUG PD


Solitaire

 
Published in EUG #50

Introduction

Solitaire is a computerised version of the one player game of the same name. Rather than use the normal pegs and board, this version makes good use of your Electron's graphics capabilities.

The aim of the game is to finish with a single 'peg' in the centre of the board, the only position at the start that is unoccupied by a peg. Pegs are removed by hopping over them with other pegs. Moves can only be made vertically or horizontally - not diagonally.

The only legal move is to hop one peg over another into a hole. The peg hopped over is then removed.

Although this may sound easy, it is in fact very difficult! You tend to end up with several pegs out on a limb, with no hope of removing them!

In this Electron version, the pegs are in fact space invaders - all the more reason to remove them! You hop an invader by moving a cursor to it using the usual keys, and then hit the space bar. This 'picks up' the invader. You then move the cursor to the target hole and press the space bar again. If it is a legal move then the invader you have jumped over is banished forever to the very darkest corners of your Electron's memory.

If you pick up an invader and then change your mind about the whole move, you can reverse matters by simply returning it to its position and pressing the space bar again.

When you have won or (shame) you have moved all that you are able, the program will detect this and finish with a suitable congratulatory or consolatory message.

Program notes

The bulk of the game is in, or called from, PROCplay, at line 2020. This procedure looks after the movement keys and calls another procedure, PROCcursor, to move the cursor around the board. PROCcursor simply deletes the cursor in the old position, by printing a space, and displays the cursor in the new position. There is also a check to see if you have tried to move the cursor off the edhe of the cross-shaped playing area (line 1790).

The rest of PROCplay checks the state of the flag, up%. This reflects whether you are in the middle of a 'hop' or just moving around the board prior to one. Either of the procedures PROCpick and PROCputdown are called depending on ths flag.

The procedure PROCcheck is called each time that PROCplay is executed after a hop, to check if the game is over yet.

You'll never find a more peaceful way to zap the aliens! Good luck.

Solitaire is included on this disk by special request. Several versions of the game exist; this one coming from Elbug Magazine 2.2. Similarly, these documents have also been reproduced from the accompanying article. If you have a better version then submit it for inclusion in EUG #51.

Dave E, EUG #50

Beebugsoft