ACTIVITIES
As it stands, ACTIVITIES is an educational program for use by younger schoolchildren. It could, however, be modified so that it could be an asset to older children as well.
It has been used by the teachers at my children's school in a slightly modified form on their disc-based BBC Micros, and they tell me it is useful and well liked (although maybe they're just being polite).
The idea is to test a child's powers of observation and association. The Electron selects a random activity from a list and draws some items on the screen which are associated with that activity. It also draws some irrelevant items.
The child's task is to decide which items are relevant and select them by pressing number keys 1-6.
If the selected item is relevant then it's ticked and the computer plays a chord, otherwise the drawing is crossed out and the computer makes a rude noise.
When the child thnks that he or she has all of the right items selected then they can press the F key, whereupon the computer will assess how well they have done.
Any drawings which should have been selected but were not are left on the screen, along with a comment. All irrelevant or correctly selected ones are rubbed out.
After ten activities (none of which are the same), a score sheet is printed and another turn is invited.
The initial instruction page can be returned to at any time by pressing the ESCAPE key and the sound effects can be turned on or off whenever the computer is expecting a key to be pressed.
Although this all sounds very daunting, in fact most children seem to be able to use the program easily and enjoy doing so.
My children run it on our Electron, but the program was originally written on a BBC, and because I am a lazy typist I'm afraid that the variable and procedure names are in upper case.
Also, because memory is at such a premium in the otherwise superb BBC/Electron computers, the variable and procedure names are rather cryptic.
Because of the way the program works, it is essential that you do not renumber it, or at least the DATA statements at lines 10000 onward.
At this juncture it's worth outlining how the program works.
I have seen many programs of a similar nature which require access to a set of data in a random way - spelling games or Hangman spring to mind.
Most programmers seem to access the data in a random way by READing the data into a string array then generating a random number to be used as an array index.
Doing this means that there are two copies of the data in the afore mentioned limited Acorn memory. (When is some bright spark going to bring out a main RAM expansion for the Electron, like there is for the BBC?)
Because it is possible in BBC Basic to use the RESTORE statement using a variable or an expression rather than a line number, any DATA statement can be READ by setting the value of the variable to the line number of the DATA statement that you want.
It looks tricky, but in fact is very easy. This means taht you must be careful how you number the DATA statements.
Finally, to save memory space and speed up the drawing process a bit, the resident integer variables have been used to some degree.
As I have already hinted, it is possible to add extra activities and drawings to the list or create a compeltely different one.
To create a new activity you must add a new DATA statement as follows (numbers are counted from 0):
100nn DATA activityname,n1,n2...ni,*
where nn is the number of the activity and n1,n2 etc are the numbers of the associated items.
There can be from one to six items in the list. The asterisk at the end is to tell the computer there are no more items in the list.
Line 19999 with the hash sign must be present to show there are no more lists. Each individual drawing is defined as shown:
200nn0 DATA itemname,M,x,y,D,x,y,E,x,y,r1,r2,a1,a2...,*
where nn is the item number and x and y are the coordinates of a 500 x 200 grid on which the item is drawn. The graphics interpreter reads these codes as follows:
M,x,y: Moves the graphics cursor to x,y without drawing
D,x,y: Draws a line to x,y from the last graphics point
E,x,y,r1,r2,a1,a2: Draws part of an ellipse with centre x,y radii r1,r2 starting at angle a1 and finishing at angle a2
The angles are measured in readians and increase anti-clockwise with 3 o'clock being zero
These codes may be in any order, but there is no error trapping, so they must be correct.
The asterisk at the end of the statement is to indicate the end of the drawing. If the codes will not all fit into one DATA statement they may be continued into another one, although the line number for this must be less than ten more than the initial one (for example, see lines 20100 and 20102).
The final DATA statement with the # indicates no more drawings are present, and it must be there.
If some clever dick of a little Johnnie points out that a so-called irrelevant item goes with an activity, just add its number to the activity list.
DODGE
You'll need nimble fingers and fast reactions for this high speed Electron Grand Prix.
As your powerful racer works its way through the field you must pass row upon row of cars.
At first they come in twos, and later, to make things even harder, threes.
As you progress your speed increases and the gap between you and the cars in front becomes smaller and smaller, making them more and more difficult to dodge.
It's hard to avoid having a smashing time!
Variables | |
ac%,UP% | Position of your car |
SC% | Score |
X%, Z%, Q% | Position of opposing cars |
HI$, HI% | High score |
E%(), W%() | Random numbers |
Procedures | |
PROCvar | Sets the variables, envelopes and characters |
PROCdown | Moves opposing cars |
PROCmove_man | Moves your car |
PROCrnd | Chooses three random numbers and places them in arrays |
PROCsetup | Draws screen |
PROCch | Prints score |
PROCdead | Ends game |
PROCbonus | Changes screen display and chooses number of rows |
PROCins | Prints instructions |
PROCHI_SC | Prints high score table |
ENGINE
Have you ever really understood how a car engine works? Never mind - sit back and let your Electron show you in this fun program from Dave Robinson.
The program first draws and names the relevant pieces of machinery involved.
It then runs through the four cycles that make up a petrol-driven internal combustion engine.
Each step is clearly labelled. Once you can follow the sequence, things can be speeded up by holding the Space bar down continuously.
The program makes extensive use of procedures with lots of meaningful names, and should be easily followed.
QUASIMODO
Esmeralder, the cook's help, has been the baron's favourite for a long time, but after her latest lunchtime offering of a burnt boiled egg she is out of favour.
The wicked baron has punished her by locking her in the tower. She is destined to be there for a long time, so undaunted you have scaled the castle wall in order to reach her and carry her away to safety.
You must now get to the tower. But it isn't quite that easy. The ramparts on their own shouldn't pose too much of a problem as you complete the first screen. But the baron is a devious old codger.
On later screens, to add to your troubles, he starts chucking boulders and firing arrows at you in an attempt to see you off (his soldiers are none too friendly either).
Use the Z and X keys to move left and right and the SHIFT key to jump.
REFLECT
By Keith Turner
Aliens are gathering strength on a very high, walled plateau in a remote part of the globe. All airborne weapons have proved ineffective against them, but it is known that the heavy proton gun can destroy them.
The problem is that it is so heavy that it can only be used from the ground and because of the position of the aliens you cannot get a direct shot at them.
The fleet commander has come up with a brilliant but dangerous solution by fitting the remaining airships with reflective material on the base.
The brave pilots have put their lives on the line by flying back and forth over the alien's position to provide you with a mirror to fire at and thereby reflect your photons on to the aliens.
If you miss the mirror and hit the ship it will be destroyed - and you only have five of them.
Every now and then the aliens launch a bomb which bursts above you and showers you with high explosive mini-bombs.
While in flight this bomb also disables your fun - most frustrating, but this is what we learn to live with in computerland!
In order to score you have to position your "sight" so that the photon hits the mirror on the airship and the reflected photons meet the alien.
The sight is a "+" at the top of the screen and is the point through which your photons will pass if not interrupted by the mirror.
Once fired, the photon's path is set and cannot be changed - it cannot be guided.
As both the ship and the alien are always moving a hit with every shot would be miraculous.
For this reason there are no levels, and the idea is to score more hits than anyone else before you are killed.
Variables | |
XS% | X coordinate of sight |
XB% | X coordinate of base |
XP% | X coordinate of photon |
YP% | Y coordinate of photon |
Xbomb | X coordinate of bomb |
Ybomb | Y coordinate of bomb |
XSHIP | X coordinate of ship |
XBAD | X coordinate of alien |
BAD% | Movement rate of alien |
diffx | Horizontal movement rate of photon |
diffy | Veritcal movement rate of photon |
SHIP% | Movement rate of ship |
score% | Current score |
lives% | Lives left |
time | Random time before bomb is launched |
Flags |
|
launched | Has bomb been launched? |
dead% | Is game finished? |
photon | Has photon gun been fired? |
Arrays |
|
X(12),Y(12) | Coordinates for shower bombs |
name$(10) | Names on hi-score table |
score(10) | Their scores |
Procedures |
|
PROCscreen | Draws battle scene, score, etc |
PROCinit | VDU 23s, initialises variables |
PROCship | Creates new ship |
PROCbaddy | Creates new alien |
PROCmoveship | Moves ship |
PROCmovebaddy | Moves alien |
PROCmovesight | Moves sight on your command |
PROCbase | Creates base |
PROCmovebase | Moves base on your command |
PROCphoton | Photon launched, sound, flight until result of shot |
PROCexpl | Rubs out what was hit and shows explosion |
PROCscore | Increments score |
PROCbomb | After random time, called to launch bomb |
PROCshower | Bomb bursts and showers down mini-bombs |
PROChiscore | Compares score with previous scores |
PROCtable | If hi-score asks for name and displays table |
PROCinstruct | Displays instructions |
PROCerror | Calls Mode 6 and reports error |