From 314622ea0b6146f22ceb2d174e119d135df5e50a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 29 Apr 2021 20:25:18 +0200 Subject: [PATCH] Fix score display --- super_simon/src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/super_simon/src/main.cpp b/super_simon/src/main.cpp index 17a7625..0c5f97b 100644 --- a/super_simon/src/main.cpp +++ b/super_simon/src/main.cpp @@ -8,6 +8,7 @@ LiquidCrystal lcd(9, 8, 4, 5, 6, 7); byte sequence[MAX_GAME] = {}; int8_t currentPosition = -1; bool win = true; +bool over = false; void setup() { pinMode(LED_BUILTIN, OUTPUT); @@ -24,6 +25,9 @@ void setup() { void loop() { if (currentPosition + 1 >= MAX_GAME) { + over = true; + } + if (over) { endGame(lcd, win, currentPosition); return; } @@ -35,7 +39,7 @@ void loop() { playSequence(sequence, currentPosition); if (!userSequence(sequence, currentPosition)) { win = false; - currentPosition = MAX_GAME; + over = true; } delay(2000);