diff --git a/.Jules/palette.md b/.Jules/palette.md index c4e3778..57672db 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -25,3 +25,7 @@ ## 2026-03-02 - Hiding the Cursor in CLI Games **Learning:** In terminal applications that require rapid visual updates or where user input doesn't involve typing text, an actively blinking cursor can be a visual distraction. Hiding it during interaction (`\033[?25l`) and rigorously ensuring it is restored (`\033[?25h`) on exit—including signal interrupts—significantly improves the aesthetic and focus. **Action:** Always hide the cursor for interactive CLI games and explicitly restore it across all exit paths, including async-signal-safe signal handlers. + +## 2026-05-24 - Live High-Score Feedback for First-Time Players +**Learning:** In competitive CLI games, displaying a live high-score target (e.g., 'Score: 10 | High: 10') provides immediate tactile reward and engagement. Furthermore, gating "NEW BEST!" indicators behind an `initialHighscore > 0` check prevents first-time players from experiencing that initial "delight" of setting their first record. +**Action:** Always include a live high-score display and ensure achievement logic is inclusive of first-time players by comparing against the session's starting score regardless of its initial value. diff --git a/src/main.cpp b/src/main.cpp index e72f1da..4721fe0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,10 +137,11 @@ int main() { } if (updateUI) { - std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " " + std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET + << " | High: " << std::max(score, highscore) << " " << (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]") - << (score > initialHighscore && initialHighscore > 0 ? " NEW BEST! 🥳" : "") - << " " << std::flush; + << (score > initialHighscore ? " NEW BEST! 🥳" : "") + << "\033[K" << std::flush; updateUI = false; } } @@ -151,7 +152,7 @@ int main() { tcsetattr(STDIN_FILENO, TCSANOW, &oldt); std::cout << "\n\n" << CLR_SCORE << "Final Score: " << score << CLR_RESET << "\n"; - if (score > initialHighscore && initialHighscore > 0) { + if (score > initialHighscore) { std::cout << "Congratulations! A new personal best!\n"; } std::cout << "Thanks for playing!\n";