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

Title and Replay

A centred title, a colour key, and a play-again loop wrap the game up. Bright Spark, complete.

100% of Bright Spark

The game plays and ends; now make it a game — one that introduces itself and invites another go. A title screen with the rules, a little colour key so the player knows which key is which, and a loop from the game-over screen back to the start. All of it is craft you have used before; this is the unit where it all comes together.

  10 BORDER 0: PAPER 0: INK 7: CLS
  20 RANDOMIZE
  30 LET a$ = "*** BRIGHT SPARK ***": LET y = 5: GO SUB 9000
  40 PRINT AT 8, 5; "Watch the panels flash."
  50 PRINT AT 9, 5; "Repeat the sequence."
  60 PRINT AT 11, 5; "Keys: 1=Red 2=Blue"
  70 PRINT AT 12, 5; "      3=Green 4=Yellow"
  80 PRINT AT 16, 5; "Press any key to start"
  90 PRINT AT 6, 11; PAPER 2; "  "; PAPER 1; "  "; PAPER 4; "  "; PAPER 6; "  "
 100 PAUSE 0
 110 CLS
 120 GO SUB 540
 140 LET s$ = ""
 150 LET s$ = s$ + STR$ (INT (RND * 4) + 1)
 170 PAUSE 25
 180 FOR i = 1 TO LEN s$
 190 LET p = VAL s$(i)
 200 GO SUB 640
 210 PAUSE 15
 220 NEXT i
 240 PRINT AT 21, 1; "Your turn!               "
 250 FOR i = 1 TO LEN s$
 260 IF INKEY$ <> "" THEN GO TO 260
 270 IF INKEY$ = "" THEN GO TO 270
 280 LET k$ = INKEY$
 290 IF k$ < "1" OR k$ > "4" THEN GO TO 260
 300 LET p = VAL k$
 310 GO SUB 640
 320 IF k$ <> s$(i) THEN GO TO 380
 340 NEXT i
 350 PRINT AT 21, 1; "Correct!                 "
 360 PAUSE 25
 370 GO TO 150
 380 BEEP 0.5, -10
 390 LET score = LEN s$ - 1
 400 CLS
 410 PRINT AT 6, 5; "*** BRIGHT SPARK ***"
 420 PRINT AT 9, 5; "GAME OVER"
 430 PRINT AT 11, 5; "The sequence was"
 440 PRINT AT 12, 5; score; " long."
 450 PRINT AT 15, 5;
 460 IF score >= 10 THEN INK 4: PRINT "Amazing!"
 470 IF score >= 6 AND score < 10 THEN INK 5: PRINT "Good memory!"
 480 IF score >= 3 AND score < 6 THEN INK 6: PRINT "Not bad"
 490 IF score < 3 THEN INK 2: PRINT "Keep practising"
 500 INK 7
 510 PRINT AT 19, 5; "Press any key to play again"
 520 PAUSE 0
 530 GO TO 10
 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

9000 PRINT AT y, (32 - LEN a$) / 2; BRIGHT 1; a$
9010 RETURN
The Bright Spark title screen: the centred title, a row of four colour blocks, the rules, the key legend, and Press any key to start
The finished game: a centred title, a colour key, the rules, and a way to begin.

The framing

Line 30 centres the title through the GO SUB 9000 subroutine from Oracle Stone — write the centring once, call it for any title. Lines 40–80 give the rules and the key legend; line 90 is a neat touch — a row of four PAPER blocks (" " in each colour) so the player sees red, blue, green, yellow next to "1=Red 2=Blue 3=Green 4=Yellow". Line 100's PAUSE 0 holds the screen until they are ready.

The replay loop

The game-over screen gains two lines: 510 prints "Press any key to play again", 520 waits, and 530 — GO TO 10 — jumps right back to the top. Because line 10 clears the screen and resets, and line 20 reseeds, every restart is a fresh game with a new sequence. That single GO TO turns a one-shot program into something you can sit and play.

What you built

Bright Spark is the biggest program in Volume 1, yet almost every line is something you already knew: panels from PAPER, a flash from BRIGHT and BEEP, taps from INKEY$, a title from GO SUB, a rating from a chain of IFs. The one new idea — a string used as a growing, indexable list — is what made a memory game possible: STR$ to extend the sequence, s$(i) to replay and check it, LEN to size every loop around it. Learn to keep a list in a string and you can build anything that has to remember an order: a high-score table, a tune, a recorded path.

Next: Hi-Lo — a higher-or-lower card game where one bad guess ends a streak you have been building all game.