Skip to content

Commit cbb7742

Browse files
🎨 Palette: Enhanced Real-time Feedback and Polished Transitions
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>
1 parent f36fbc5 commit cbb7742

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎.Jules/palette.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@
2525
## 2026-03-02 - Hiding the Cursor in CLI Games
2626
**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.
2727
**Action:** Always hide the cursor for interactive CLI games and explicitly restore it across all exit paths, including async-signal-safe signal handlers.
28+
29+
## 2026-06-25 - Real-time Target Feedback in CLI Games
30+
**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.
31+
**Action:** Always include a real-time record/target indicator in gameplay UIs and ensure celebration logic is inclusive of first-time users.

‎src/main.cpp‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int main() {
9494
}
9595

9696
for (int i = 3; i > 0; --i) {
97-
std::cout << "\rStarting in " << i << "... " << std::flush;
97+
std::cout << "\rStarting in " << CLR_CTRL << i << CLR_RESET << "... " << std::flush;
9898
auto start_wait = std::chrono::steady_clock::now();
9999
while (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start_wait).count() < 1000) {
100100
int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start_wait).count();
@@ -108,7 +108,7 @@ int main() {
108108
}
109109
}
110110
}
111-
std::cout << "\rGO! \n" << std::flush;
111+
std::cout << "\r" << CLR_NORM << "GO! " << CLR_RESET << "\n" << std::flush;
112112
std::this_thread::sleep_for(std::chrono::milliseconds(200));
113113
tcflush(STDIN_FILENO, TCIFLUSH);
114114

@@ -137,10 +137,13 @@ int main() {
137137
}
138138

139139
if (updateUI) {
140-
std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " "
141-
<< (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]")
142-
<< (score > initialHighscore && initialHighscore > 0 ? " NEW BEST! 🥳" : "")
143-
<< " " << std::flush;
140+
std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET;
141+
if (initialHighscore > 0 || score > 0) {
142+
std::cout << " | High: " << (score > initialHighscore ? score : initialHighscore);
143+
}
144+
std::cout << " " << (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]")
145+
<< (score > initialHighscore ? " NEW BEST! 🥳" : "")
146+
<< " " << CLR_RESET << std::flush;
144147
updateUI = false;
145148
}
146149
}
@@ -151,7 +154,7 @@ int main() {
151154

152155
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
153156
std::cout << "\n\n" << CLR_SCORE << "Final Score: " << score << CLR_RESET << "\n";
154-
if (score > initialHighscore && initialHighscore > 0) {
157+
if (score > initialHighscore) {
155158
std::cout << "Congratulations! A new personal best!\n";
156159
}
157160
std::cout << "Thanks for playing!\n";

0 commit comments

Comments
 (0)