Click Here To Go To The Your Computer Archive

Written By M. J. Parrot

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

Flight Of Fancy

M. J. Parrot, Stockport, Cheshire

The game is for the Model B and is the traditional 501 down, finishing on a double or the bull. Lines 10,220 give the instructions for the game, ask the number of players and take in the names of the players. If there is only one, then player 2 is assigned the name Beeb (line 210) and the logical variable Beeb is set True.

After pressing the space bar (lines 230,240) the game can begin but we first have to draw the boad. This is the most complicated part of the program because some trigonometry is used. Line 1170 first sets minimum and maximum values for X and Y so that the cross-hair cannot wander off the edge of the screen. The two variables Dif and Mote are used to draw the cross-hair and move it around the board. Line 1180 reads the scores for each sector of the board into an array S in a counter-clockwise fashion beginning and ending with the 6 (at three o' clock). The origin of the graphics page is set to the centre of the screen and we are set for drawing sectors and circles around this central point. The radii which delimit the bull, the outer bull, the trebles and the doubles are set in line 1200 and two variables C and S are set to the cosine and sine respectively of 0.02 of Pi because the sectors are drawn recursively to save time. I used the triangle fill mode to draw five pairs of triangles in each segment since this nicely fills the screen leaving a clear image without unlit pixels.

The main part of the board is drawn by a pair of nested FOR...NEXT loops. The outer loop - lines 1210-1280 - steps around the board in steps of 18 degrees.

The inner loop - lines 1230-1260 - draws four segments within each sector by calling Procedure Sector. Within the loop the colour is changed alternatively between the two logical, graphical foreground colours 0 and 1 by the line 1240 which uses the variable K which was initially set in line 1200. On leaving the inner loop the logical colour is once more changed to allow for the start of the next sector.

Procedure Sector Moves the graphics cursor to the start X,Y of the segment and Draws the leading edge up to the point X1,Y1. The third point of the triangle 1 is calculated recursively and the triangles are filled in. The next triangle 2 is drawn and then on the next pass of the loop two new points are calculated and two new triangles are filled in. In this way each segment of each sector is drawn using pairs of triangles.

Lines 1290 and 1300 print the scores - the array S - around the board by calculating the necessary points on the circle, and slightly adjusting the position for the numbers 18, 13, 10 and 15 so that the board appears balanced. Note that the Text and Graphics Cursor were combined in line 1190. Line 1360 draws the wires around the board using the Procedure Circle with the necessary radii being passed to it. The only thing left to do is draw the bull in the centre; again done by the PLOT 85 command.

The game proceeds by a set of nested REPEAT...UNTIL loops. The outer is controlled by the logical variable Finish which only becomes true when the player elects to end the game in lines 580, 590.

The next inner loop - lines 340-560 - is controlled by the logical variable Gameover which is set true in Procedure Totalise if the scoring is okay for a permissible finish to the game.

The next loop in is controlled by three variables, Dart, Gameover, and Bust. The latter is set true in Procedure Bust if the cumulative score - the variable TScore - for the three darts - controlled by the counter Dart - is greater than the score - Score (Player) - already obtained by the player.

In the innermost a series of Procedures first move the cross-hair around the board using the GCOL 3 command to first draw - line 980 - and then erase - line 1000 - a cross at a position X,Y is randomly moved in a REPEAT...UNTIL loop unless the player moves it.

Within this loop a check is made - line 1050 - to see if the machine should play, in which case Procedure Mygame is invoked. Here a series of simple If statements is used to make a decision about where to land a dart. X and Y are set but to make it fairer, X and Y are randomised by the same degree to which the cross-hair's movement is subjected.

Line 420 checks to see whether a wire has been hit. Because they were drawn in the background colour 2 - yellow - line 470 has to reset the logical variable Wireflag back to False if the point was really off the board or in the 25 region. This could have been allowed for in line 420. Note that the darts are drawn in yellow on a black background and so hitting a dart can result in a zero score and the message "wire". The rest of the program is concerned with drawing the dart, writing the score of each individual dart, and writing the scores of the players together with their names. The only complicated part occurs in Procedure Score. Here the position of the dart is first remembered by the arrays DartX and DartY for subsequent removal and then the radial distance of the dart from the board's centre is calculated in line 680. A series of Ifs then checks the radial distance R to provide initial scorings. the order of these is quite important because the number of checks can be kept to a minimum. Thus scores of 50, 25 and 0 are easily checked. After checking - line 710 - for the wire having been hit, the angle measured anti-clockwise round the board from the middle of the 3 o'clock sector - that scoring 6 - is calculated by the ACS function - line 720 - which may have to be adjusted if the dart is in the bottom half of the board.

The next line, 730, essentially takes this angle Theta and divides it by PI/10 to calculate which sector the dart is in and therefore which array element will provide the score. PI/20 is subtracted to allow for the counter-clockwise rotation around the circle.

Now here comes the slightly non-mathematical "adjustment" to make the scoring right. If the dart were to land in the bottom part of sector 6 the measured angle would be slightly negative and so 1 should be added to the calculation to give the array element. However, because of the way the sectors were drawn, the trigonometry is slightly awry and so I only add 0.7. This makes the scoring correct as it appears on the screen. Having found which sector the dart is in, it is an easy matter to check for doubles and trebles by looking at the radial distance from the centre of the board - lines 740-750. If the score is a double then the logical variable Double is set true. Note that it is also set true if 50 is scored because it is used to check for a legal end to the game in line 1560.