Skip to content
Game 6 Unit 2 of 6 1 hr learning time

The Flash

A second subroutine lights one panel BRIGHT and sounds its tone — the single action the whole game is built from.

33% of Bright Spark

The board is the stage; the flash is the action. Everything Bright Spark does — showing a sequence, echoing the player's taps — is built from one move: make a panel light up and sound its note. Build that as its own subroutine now, and the rest of the game just calls it.

  10 BORDER 0: PAPER 0: INK 7: CLS
  20 RANDOMIZE
 110 CLS
 120 GO SUB 540
 140 LET p = INT (RND * 4) + 1
 150 GO SUB 640
 160 STOP
 540 REM --- Draw all panels ---
 550 PAPER 2
 560 FOR r = 2 TO 9: PRINT AT r, 1; "       1      ": NEXT r
 570 PAPER 1
 580 FOR r = 2 TO 9: PRINT AT r, 17; "       2      ": NEXT r
 590 PAPER 4
 600 FOR r = 12 TO 19: PRINT AT r, 1; "       3      ": NEXT r
 610 PAPER 6
 620 FOR r = 12 TO 19: PRINT AT r, 17; "       4      ": NEXT r
 630 PAPER 0: RETURN
 640 REM --- Flash panel p ---
 650 IF p = 1 THEN PAPER 2: LET pr = 2: LET pc = 1: LET note = 5
 660 IF p = 2 THEN PAPER 1: LET pr = 2: LET pc = 17: LET note = 10
 670 IF p = 3 THEN PAPER 4: LET pr = 12: LET pc = 1: LET note = 15
 680 IF p = 4 THEN PAPER 6: LET pr = 12: LET pc = 17: LET note = 20
 690 BRIGHT 1
 700 FOR r = pr TO pr + 7: PRINT AT r, pc; "              ": NEXT r
 710 BEEP 0.3, note
 720 BRIGHT 0
 730 FOR r = pr TO pr + 7: PRINT AT r, pc; "              ": NEXT r
 740 PAPER 0: RETURN
The Bright Spark board with the red panel lit bright, its number blanked, the others normal
Panel 1 flashes: lit BRIGHT and blanked for a moment, with a tone, then back to normal.

BRIGHT, then back

Line 140 picks a random panel with INT (RND * 4) + 1 — the same die roll as ever, narrowed to 1–4 — and line 150 calls the flash subroutine at 640. There, lines 650–680 look up that panel's colour, position and note. Then the flash itself: BRIGHT 1 (line 690) switches on the lighter version of the colour, lines 700 repaint the panel so the brightness takes hold, BEEP 0.3, note sounds its tone, and BRIGHT 0 with a repaint (720–730) returns it to normal. BRIGHT is part of the colour set you met in Meet BASIC; here it is the difference between "resting" and "lit".

One note per panel

Each panel carries its own pitch — note is 5, 10, 15 or 20 (lines 650–680), so the four panels sound a rising scale. That matters for the game: a player can learn the sound of the sequence as much as the sight of it, exactly as real Simon works. Sight and sound, one panel, one subroutine — the atom the whole game is made of.

Next: a sequence of these flashes, remembered in a string.