Click Here To Go To The Your Computer Archive

Written By Peter Donn

Cover Art
Click Here To Enlarge Loading Screen

Loading Screen
Click Here To Enlarge Opening Screen

Opening Screen
Click Here To Enlarge Screenshot

Game Screenshot

Snakes And Ladders

Peter Donn adds a new mathematical twist to the traditional game of Snakes and Ladders in this two¬player version for the BBC Model B in Mode 2. There are six skill levels

What is the appeal of Snakes and Ladders? Does it lie in its ability to mirror the unpre-dictable ups and downs of life - or is it a throwback to Biblical times when snakes could be relied upon to lead you astray?

Whatever the case may be, I have developed a complete representation of this game on the BBC Model B computer which utilises its colourful graphics to the full potential and likewise the sound capabilities. One sub¬stantial feature has been added to the game. There are mathematical questions, the difficulty of which is stated at the start. This educational Snakes and Ladders is ideal for those between the ages of 2 and 16.

The program is split up into two parts which are loaded one after the other. This is simply because of the lack of memory on the BBC Model B using mode 2. The first part is concerned mainly with the definition of graphics characters, and there are quite a few of them.

The game is for two players and when Run asks them for their names. You then choose the difficulty level: level 1 is the easiest, and level 6 is the hardest. It is still possible to get easy questions on level 6 though, because the level decides on the range of values the computer chooses from when deciding on the question to give you.

As you watch the display being built up, you will see that there is a border around the edge, the main board on the left two-thirds of the screen, and each player's dice and score on the top-right and bottom right of the screen. On the left-hand side of the screen, in the border, i displayed the current skill level.

A question - adding, subtraction, multi¬plication or division - is given as someone i about to go up a ladder or down a nake. You have eight seconds to answer a question. Once a number is typed it cannot be deleted. Should you finish before the time is up, pressing the space-bar will continue the program. Getting the question right will either allow you to go up a ladder or not go down a snake, depending on your position.

Just in case the program does not make it clear, to roll your dice press D. Your dice will roll a few times with the appropriate sound effects. You are then' asked if you are ready to move. If you are, press Y. If you arc lucky enough to get a six on your dice, you an have another go. The winner is the first person to jump off the last square of the board, at the top righr. The program then plays For He's a Jolly Good Fellow, and the players can decide if they want another go. If so, 1 is added to their score - displayed on the screen - and the game is restarted, with an option to change the skill level again. If not, new players can play, and the game is automatically run again.

Playing The Game

Firstly, type in program 1. Run it to see if it works - and make sure it does. All it displays is a green mode 2 screen, and some writing saying that the first part is loaded and the computer is ready for the second part. Save the program on cassette calling it:


Now press Break and type in the second program. Do not run this but save on tape calling it:


Now press break and type:


This is to give access to a further 256 byte of memory which is not being used. Type this also before loading the game in future.

CHAIN the first program and continue to load the second program which should have been saved on tape after the first program. Any errors in the second program can now be dealt with. Do not at any time press Break. If you do this, you will be greeted by:

Bad Program

If you do - type:
?&E00 = 65 (RETURN)
?&E01 = 65 (RETURN)

and the program can now be listed. But you will find that after the first page of memory there are two letter As, which seem to have appeared from nowhere. You will have to correct that part of the program. It makes things that much easier if you do not press Break. To make correcting errors easier, type MODE 7 after the error report and PRINT ERL. Alternatively, add the following line at the start, and delete it once the program is running correctly:


Program Outline

For the sake of those people who are interested in the BBC features used in the program and some ofthe techniques involved in the production of the program, and also those people who are mad enough to want to try to convert the program to work on another computer, here is a breakdown of the program.

Program 1, line 70 sets up the delay time in the auto-repeat function of the keys. Lines 80 and 90 set up the colour flash rates. 100 and 110 define sound effect envelopes. Lines 120-150 store character definitions in memory locations &C00 to &D00 and represent characters 224 to 244. Most are dice numbers. Line 180 loads the second program.

In program 2, lines 10 to 20 set up various variables used in the program. U$ saves space later in the program where it is needed to plot the top and bottom of the dice. CHR$8 is the backspace cursor, CHR$10 takes the cursor down one line. In line 10, an array is set up which stores the co-ordinates of the corner of each square. It also tells the computer if there is a snake or ladder end on the square. Line 30 checks to see if a program has been played before. H% and J% are the scores. Line 60 prints up the title in a sine wave form - like a snake - and allows input of the names into Z$ and Y$. At line 70 the computer decides who is to go first. From 100 to 130 the screen display is built up and the array is filled with the appropriate co-ordinates. At line 140 heads and tails are put onto the ends of the snake body. Then, at 150, ladders are plotted and the game is started. The finale of the game is at lines 160 to 250. There are options to have another game. The data of all co-ordinates of all turning points on snakes, and ends of sides of each ladder are contained in lines 260-290. Line 300 is the procedures to draw the box - each section of the board, and line 310 is the procedure to draw snakes' heads and tails.

Climbing The Ladder

Line 320 is the procedure to draw rungs on ladders. A mathematical approach was used here. The distance between two points X,Y and P,Q on a Cartesian co-ordinate system is given by

SQR (((x-p)squared) + ((y-q)squared))

Since we know the co-ordinates of the top and bottom of the sides of the ladder, we can now find out how many rungs there are on each ladder - if the distance between the rungs on all ladders is the same. We then plot a rung at the right points up each ladder. At 340 the game itself starts. A 1 is put into the array

A(4, ?)

The question mark represents the numbers of the squares which contain the bottom of a ladder or the top of a snake. At lines 390 to 530 the first player starts, throws his dice and makes his move. The second player's turn comes at lines 540 to 670. 690 to 740 contain the six routines for plotting the dice number - one for each possible roll of the dice. Line 750 is the procedure to actually go about plotting dice, making a rolling sound, and leaving a consecutively smaller gap between successive frames of the dice throw. Lines 800 to 890 actually move down a snake or up a ladder, if the question has been answered correctly. Line 900 contains the data for For He's a Jolly Good Fellow, and line 920 chooses a question.

Range Of Values

Lines 930 to 1010 put a question on the screen and check for an answer in a limited time. Line 1090 gives a range of values chosen by the computer for maths questions. The range is different for division, multiplication, addition, and subtraction.

For those of you who are just a bit lazy, and would like to take the easy way out, send a cheque or P.O. for £2.80 to the following address, and I will send you a copy of the program on a cassette, ready and working:

Peter Donn, 33 Little Gaynes Lane, Upminster, Essex, RMI4 2JR.