Electron User 2.01 ================== Alphaswap --------- The Electron becomes a brain-teasing machine with ALPHASWAP, a solo logic game from Peter Hart. When you run the program the first sixteen letters of the alphabet are displayed - in order - on the screen. Then the micro mixes them up, leaving you the job of getting them back to the original alphabet. But it's not as easy as it might seem. To get them back into order you have to pick groups of four letters at a time and rotate them in an anticlockwise direction. This is done by telling the Electron the top left letter of the four you want to move. And that's all there is to it. The rules are simple - the game itself isn't! If you fancy yourself as a mental athlete, then ALPHASWAP is the game for you. Line(s) Description 10 Programs function key 0 to play the game again 60 Sets background colour to blue 70 Defines a text window in which the Electron can comment on the player's actions 80 Says goodbye to the flashing cursor! 90 Sets the graphics operations such that any colour plotted will invert the colour already there. Since it is in Mode 4 (two colours), it will first plot the desired letter by inverting the background to the foreground colour. Then, by plotting the same letter in the same place, it will invert the colour back to the background colour, making it disappear 100 Dimensions arrays to hold letters and their positions. R holds the rows, C the columns, L$ the present letters, F$ holds correct positions of letters for checking. 110-200 Main program segment. Initialises arrays and sets up screen. It then muddles up the letters and enters the game loop which repeats until letters are correctly positioned. 220-260 Gets a letter from the keyboard. *FX1,51 clears the buffer 280-510 Joins text and graphics cursors. The first loop assigns a letter to each element of L$, and then repeats for each element of F$. G is the gap between each letter, with X, Y being the position of first letter plotted. The others are plotted relative to this (lines 420-480) and their positions are "remembered" with the arrays C and R. 530-640 Moves the relevant four letters 660-710 Plots these four letters 730-770 Forms a delay, used throughout the program 790-900 Gives introduction to game 920-1060 Steps letters anticlockwise by continually plotting and unplotting them 1080-1140 Checks whether player has returned all letters to their original positions by comparing L$ and F$ 1160-1270 Plays a tune and congratulates player 1290-1620 Muddles up letters, the amount of muddle depending on level chosen 1640-1720 Decides whether letter is on the bottom or righthand edge 1730-1790 Sets up sounds used throughout the program 1810-2070 Gives player instructions and choice of difficultyBREAKFREE BREAKFREE, written by Jonathan Church, is an Electron version of the arcade classic, and it's a must for action game freaks. With its 80-brick, multi-coloured advancing wall, changing ball speed, three levels of difficulty and constant onscreen scoring, it's enough to test anyone's wits and reflexes. You control a yellow bar at the foot of the screen. A red ball darts around, bouncing off anything it encounters. You must attempt to bounce the ball against every brick in the wall. Unfortunately, the ball does not always leave the wall at the same speed that it hit it, so you have to be able to react quickly. You start the game with three bats but you get a bonus bat every time a wall is totally cleared, along with an extra 500 points and a small tune. When a wall is cleared a new one will be built lower down the screen - giving you less time to manoeuvre your bat into a position where it is possible to hit the ball. And to make things even more difficult the speed of the ball will increase. Lives are lost when you fail to hit the ball with the bat. When all lives have been lost, you will be played the first few bars of the Death March. If your score is high enough you will be asked to place your name in thie high score Hall of Fame table. When the program starts you will be given some brief instructions which tell you what keys to press to move the bat, and how many points the different colours bricks score. You will then be asked what sound options are required. There are four of these - total sound on, total sound off, game effects only and tunes only. As well as being able to choose the sound at the start of the game it is also possible to change it during actual play by pressing the relative key - 1, 2, 3 or 4. Then you will be asked for the ball speed - fast, medium or slow. During play you can halt the action by pressing RETURN. The game will resume from where it stopped by pressing any other key. Suggested Extensions: The wall can be made to move further down when a screen is cleared by increasing the value of WA% in line 170. By changing the string value of k% in line 1170 any keys can be used to move the bat left and right. The initial speed of the ball can be increased by changing the value of bndelay% in line 2080. The smaller the value, the quicker the action. Also the responsiveness of the bat can be altered by changing the values of the *FX calls in lines 830 and 840. *FX11 sets the auto-repeate delay on the key, and *FX12 sets the period of auto-repeat. For more information on these *FX calls, see Appendix D on page 281 of the ELECTRON USER MANUAL. Variables NI%(A) The Ath high score HI$(A) Name of the Ath highest scorer SC% Current score CRICK% Number of bricks left in wall W% Y coordinate of wall X% X coordinate of wall WA% Amount to be added to Y coordinate of wall A% Colour of a row of bricks SO% Volume of tunes SO1% Volume of sound effects C% Volume and envelope number of a sound statement P% Pitch of a note D% Duration of a note del Delay note A$ Contains the words GAME OVER Z$ One of characters of A$ L% Position of character Z$ selected by MID$ in A$ and its colour bx% X coordinate of ball by% Y coordinate of ball nx% X coordinate of space which deletes ball ny% Y coordinate of space which deletes ball WALL% Logical colour of poin the ball is travelling over btx% X coordinate of bat bty% Y coordinate of bat BATLEFT% Number of bats left missed% TRUE if ball is below the bat and FALSE if it is above it ball$ The ball bat$ The bat xdir% X direction of ball ydir% Y direction of ball k$ The time the computer waits for you to press a key bdelay%, btime%, BTIME Delays to stop ball's speed increasing when bat is not being moved  Procedures PROCinitialise Produces high score table. Defines graphics and envelopes PROCsetup Switches cursor off and changes logical colour 3 to actual colour 6. Also sets number of bricks in wall, the score and number of bats left. Sets coordinates for bat and draws it, and redefines key auto-repeat PROCinstructions Prints instructions. Sets initial speed of ball and sound options PROCnewball Sets coordiantes of ball and initial direction it will take. Also empties input buffer PROCmovebat Checks whether necessary keys have been pressed to move bat. If they have, the bar is moved one position in correct direction. Also checks whether keys 1, 2, 3 or 4 have been pressed to change the sound options. PROCmoveball Moves ball one position in correct direction. Checks whether ball has hit side of screen, or top or bottom of screen. Also checks whether ball has issed the bat or hit the wall PROCdraw_wall Draws wall! PROCrestart Resets speed of ball and position of bat PROCspeedup Increases speed of ball, checks wall is not too far down the screen, and that ball is not too fast. Also increases amount of bats by one and adds 500 points to score PROCtryhit Checks whether ball has hit the bat PROCdirection Decides which direction ball will take after hitting the bat PROChitwall Changes direction of ball. Increases score and changes speed of ball if necessary