Program listing on 48K Spectrum.
1 RANDOMIZE : LET a$="": POKE 23693,7: CLS : FOR k=1 TO 4: CIRCLE 131,84,CODE " #NR"(k): INK k: LET e=k=2 OR k=4: PRINT AT 6+10*(k>2),11+10*e;k: FOR p=-23 TO 0: PLOT 232*e-88-p,33-(k<3)*168-p: DRAW OVER 1;31,0: NEXT p: INK 8: LET a$=a$+"1234"(RND*4+.5): NEXT k: PRINT AT 10,14;"SIMON";AT 12,16;p: BORDER 0: INPUT ': FOR d=-2*PI TO 6 STEP PI/2: PLOT 131+35*SIN d+4*SGN d*COS d,84+35*COS d-4*SGN d*SIN d: DRAW 42*SIN d,42*COS d: NEXT d: FOR c=1 TO p: LET q=VAL a$(c): FOR v=1 TO 8: BEEP (v=5)/2,q*5-8-3*(q=4): PRINT AT v+4*(v<5)+9*(q>2),16*(q=2 OR q=4); OVER 1; BRIGHT v<5,: NEXT v: NEXT c: BORDER 6: FOR c=1 TO k: LET q$=INKEY$: POKE 23620,13+2*(c<=p)*(10+(q$>"0")*(q$<"5")-5*(q$=a$(c))): BEEP 1,-9 |
The BORDER is black whilst the CPU plays the current sequence (to be carefully observed by the player). When the sequence has finished playing, the border turns yellow to indicate the computer is ready to accept the player's input. There is no time limit on the player's input as the computer will wait indefinitely. If an incorrect button is pressed, then the game immediately ends with the board displaying the length of the current sequence that the player failed to reproduce correctly. Try to stay in the game as long as possible and you will notice that it gets considerably more difficult as the sequence gets longer. Each button has it's own unique note associated with it. More experienced players can remember the sequence as a tune, rather than as a sequence of numbers, which can help to remember longer sequences more easily.
The initial version of the game needed many optimisations so that the graphics could be refined and the score printed onto the screen. These features could not originally be fitted into the available one-liner space. However, due to countless optimisations and refinements by Einar Saukas and Dr. BEEP, enough space was saved in order to greatly improve the game. Additional suggestions were supplied by World of Spectrum forum member "bigjon". Apart from optimisations, particular improvements were suggested by Einar Saukas (for example, the use of a black background because it works well when we use the BRIGHT attribute to flash the buttons), and also Dr. BEEP (for example, the use of PLOT and DRAW to draw the neatly shaped buttons).