Beleagured Castle v2.0

By Richard Dimond

Originally published in EUG #21

I'm always pleased to have comments, suggestions and criticism of my articles and programs and John McHugh's comments on my game Beleagured Castle really made me think! I have been able to make v2.0 which includes his routine for going back to six moves and also modifications for repeating deals. I have also added a count of the moves made and other small changes. I hope these will increase the enjoyment of the game.

Regarding his comments on playing the game, I agree that you must create spaces as soon as possible so that you can swap cards around. Another point is to try to avoid creating too long a sequence on the A to H stacks until you have space to move around as this makes it difficult to get the cards out from underneath. Also, since only the top seven cards of these stacks are shown, it is easy to forget the cards that are at the bottom of the stacks. If you cannot get the lower value cards on to the aces, the deal is, of course, impossible.

I agree to the removal of the sound command if this speeds up the program: it is rather slow with the normal Elk - a Turbo makes a world of difference! The reference to sound effects was really for a beep for a move and a rasp for an illegal move plus a fanfare on completion of a deal though I don't think they are really necessary and have not added them.

I have now been able to add John's suggestion of an 'undo' routine. This called for several changes and additions so this is v2.0, which also includes the re-deal routine given last time and a count of the moves made. On completion of a deal, the deal number and moves made are shown.

To go back a move, press "U" for each move back and when six moves have been taken back, you will get the message 'You can't move there'.

Program Notes

I have altered the instructions in the file CASTLE1, but have not been able to include all I wanted to because of limited memory with PAGE set at &1D00.

In CASTLE2, the moves are stored in the string m$ and this is limited to the last six moves by the use of RIGHT$(m$,12). The figure 12 could be altered to allow more moves if you wish but the numbers must be the same and be equal to double the number of moves. String s$ takes off the last two characters of m$ for each move back and then converts the values for from% and to%.

PROCkey has been rewritten using INSTR as I had some problems with the old routine and also this simplifies the programming.

PROCmove of v1.0 is now split into PROCfrom and PROCto as this saves using too many GOTOs. Each of these has two sections; one for stacks 1-4 and the other for A-H. The check PROCs have been rewritten and these are bypassed when chk is FALSE on selecting the 'undo' routine.

I have also added the printing of the move number as I thought this would give further interest and thus increase whether you move forward or back.

I hope these notes on the program are of interest and the revised program adds to the enjoyment of the game.

Richard Dimond, EUG #21