From cbb774268bd1f13ee9d4d00e03cc201bd8ca2559 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 17:39:29 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Enhanced=20Real-time?= =?UTF-8?q?=20Feedback=20and=20Polished=20Transitions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR introduces several micro-UX improvements to the Speed Clicker game: - Colorized the pre-game countdown (Yellow) and "GO!" prompt (Green) for better state transition feedback. - Added a real-time "High Score" indicator during gameplay, giving the player a clear target. - Refined the "NEW BEST! 🥳" and final "Congratulations!" logic to be inclusive of first-time players. - Ensured the live status line consistently applies an ANSI reset to prevent color bleeding. - Recorded the "Real-time Target Feedback" learning in the Palette journal. Co-authored-by: aidasofialily-cmd <247843425+aidasofialily-cmd@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ src/main.cpp | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index c4e3778..a0648b4 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-06-25 - Real-time Target Feedback in CLI Games +**Learning:** Providing a real-time "High Score" target during gameplay, rather than just at the end, creates a more engaging and goal-oriented user experience. Furthermore, celebratory indicators like "NEW BEST!" should be inclusive of the very first play session by checking if the current score exceeds the initial high score, even if that initial score was zero. +**Action:** Always include a real-time record/target indicator in gameplay UIs and ensure celebration logic is inclusive of first-time users. diff --git a/src/main.cpp b/src/main.cpp index e72f1da..b2db407 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,7 +94,7 @@ int main() { } for (int i = 3; i > 0; --i) { - std::cout << "\rStarting in " << i << "... " << std::flush; + std::cout << "\rStarting in " << CLR_CTRL << i << CLR_RESET << "... " << std::flush; auto start_wait = std::chrono::steady_clock::now(); while (std::chrono::duration_cast(std::chrono::steady_clock::now() - start_wait).count() < 1000) { int elapsed = std::chrono::duration_cast(std::chrono::steady_clock::now() - start_wait).count(); @@ -108,7 +108,7 @@ int main() { } } } - std::cout << "\rGO! \n" << std::flush; + std::cout << "\r" << CLR_NORM << "GO! " << CLR_RESET << "\n" << std::flush; std::this_thread::sleep_for(std::chrono::milliseconds(200)); tcflush(STDIN_FILENO, TCIFLUSH); @@ -137,10 +137,13 @@ int main() { } if (updateUI) { - std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " " - << (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]") - << (score > initialHighscore && initialHighscore > 0 ? " NEW BEST! 🥳" : "") - << " " << std::flush; + std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET; + if (initialHighscore > 0 || score > 0) { + std::cout << " | High: " << (score > initialHighscore ? score : initialHighscore); + } + std::cout << " " << (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]") + << (score > initialHighscore ? " NEW BEST! 🥳" : "") + << " " << CLR_RESET << std::flush; updateUI = false; } } @@ -151,7 +154,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";