Skip to content

Commit 57fa53c

Browse files
🎨 Palette: Inclusive Achievement Feedback and UI Polish
- Improved live score display with high score tracking - Colorized countdown and GO! prompt - Removed `initialHighscore > 0` check to include first-time players in achievements - Switched to `\033[K` (Erase in Line) for cleaner UI updates Co-authored-by: aidasofialily-cmd <247843425+aidasofialily-cmd@users.noreply.github.com>
1 parent f36fbc5 commit 57fa53c

2 files changed

Lines changed: 11 additions & 6 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-10-24 - Inclusive Achievement Feedback in CLI Games
30+
**Learning:** For first-time players, achieving their very first score is a significant milestone. Hard-coding checks like `initialHighscore > 0` before showing "NEW BEST!" or congratulations messages accidentally excludes new users from that immediate positive reinforcement.
31+
**Action:** Always ensure achievement logic (e.g., 'NEW BEST!') is inclusive of first-time players by comparing current progress against the session's starting point without requiring a pre-existing record.

‎src/main.cpp‎

Lines changed: 7 additions & 6 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,11 @@ int main() {
137137
}
138138

139139
if (updateUI) {
140-
std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " "
140+
std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET
141+
<< " | High: " << (score > highscore ? score : highscore) << " "
141142
<< (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]")
142-
<< (score > initialHighscore && initialHighscore > 0 ? " NEW BEST! 🥳" : "")
143-
<< " " << std::flush;
143+
<< (score > initialHighscore ? " NEW BEST! 🥳" : "")
144+
<< "\033[K" << std::flush;
144145
updateUI = false;
145146
}
146147
}
@@ -151,7 +152,7 @@ int main() {
151152

152153
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
153154
std::cout << "\n\n" << CLR_SCORE << "Final Score: " << score << CLR_RESET << "\n";
154-
if (score > initialHighscore && initialHighscore > 0) {
155+
if (score > initialHighscore) {
155156
std::cout << "Congratulations! A new personal best!\n";
156157
}
157158
std::cout << "Thanks for playing!\n";

0 commit comments

Comments
 (0)