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

Game Over and Score

A wrong tap jumps to a game-over screen — your score is the sequence length you reached, and a rating turns that number into a verdict.

83% of Bright Spark

A bare STOP on a wrong tap is no ending. The game needs to end well: tell the player how far they got, and judge it. The score writes itself — it is how long the sequence had grown — and the rating is the same IF-chain pattern you built in Lucky Number and Reflex.

  10 BORDER 0: PAPER 0: INK 7: CLS
  20 RANDOMIZE
 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 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
ZX Spectrum game-over screen: BRIGHT SPARK, GAME OVER, The sequence was 3 long, and Not bad in yellow
Game over: the score is the sequence length reached, with a rating to match — here, 3 and 'Not bad'.

The score is already there

The wrong-tap test on line 320 now jumps to line 380 instead of stopping. There, line 390 works out the score: LET score = LEN s$ - 1. The sequence the player failed on was LEN s$ long, so the number they completed is one less — that is the score, and it comes straight from the string. Line 380's low BEEP 0.5, -10 is the buzzer; line 400 clears for the end screen.

Turning a number into a verdict

Lines 460–490 are a rating chain on score: 10 or more is "Amazing!", 6–9 "Good memory!", 3–5 "Not bad", under 3 "Keep practising", each in its own INK colour. It is the exact shape of Lucky Number's guess rating and Reflex's reaction verdict — a ladder of IFs, each owning one band of the range. Line 500 resets INK 7 so later text prints white.

A score and a rating turn "you lost" into "you reached 7 — good memory." Same fact, far better ending. All that is missing now is a front door and a way to play again.

Next: a title screen and a replay loop — the finished game.