Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@
## 2025-01-24 - Real-time Achievement Feedback in CLI
**Learning:** In terminal-based games, displaying achievement progress (like a live high score) in real-time provides immediate tactile reward and engagement. Furthermore, inclusive UX means ensuring first-time players also receive "New Best" feedback, even when their initial record is zero.
**Action:** Update session-high-score variables immediately upon record-breaking and display them in the live HUD. Ensure achievement conditions (`score > highscore`) don't exclude the first-time user experience.

## 2025-05-24 - Motivational Progression in CLI
**Learning:** In terminal-based games where players compete against a personal record, providing a "remaining points" or "tied" indicator in real-time creates a strong sense of progression and motivates continued effort before the high score is actually surpassed.
**Action:** Always include proximity-to-goal indicators (e.g., "to go", "Tied!") in the HUD of competitive CLI games to drive engagement and provide tactical context.
23 changes: 18 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main() {
std::cout << "Controls:\n " << CLR_CTRL << "[h]" << CLR_RESET << " Toggle Hard Mode (10x Speed!)\n "
<< CLR_CTRL << "[q]" << CLR_RESET << " Quit Game\n " << CLR_CTRL << "[Any key]" << CLR_RESET << " Click!\n\n";

std::cout << "Press any key to start... " << std::flush;
std::cout << "Press " << CLR_CTRL << "any key" << CLR_RESET << " to start... " << std::flush;
struct pollfd start_fds[1] = {{STDIN_FILENO, POLLIN, 0}};
if (poll(start_fds, 1, -1) > 0) {
if (read(STDIN_FILENO, &input, 1) > 0 && input == 'q') {
Expand Down Expand Up @@ -142,9 +142,14 @@ int main() {

if (updateUI) {
std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " | High: " << highscore << " "
<< (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]")
<< (score > initialHighscore ? " NEW BEST! 🥳" : "")
<< " " << std::flush;
<< (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]");
if (score > initialHighscore) {
std::cout << CLR_CTRL " NEW BEST! 🥳" CLR_RESET;
} else if (initialHighscore > 0) {
if (score == initialHighscore) std::cout << " (Tied!)";
else std::cout << " (" << (initialHighscore - score) << " to go!)";
}
std::cout << " " << std::flush;
updateUI = false;
}
}
Expand All @@ -156,7 +161,15 @@ int main() {
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
std::cout << "\n\n" << CLR_SCORE << "Final Score: " << score << CLR_RESET << "\n";
if (score > initialHighscore) {
std::cout << "Congratulations! A new personal best!\n";
std::cout << CLR_CTRL << "**************************\n"
<< " NEW PERSONAL BEST! 🏆\n"
<< "**************************\n" << CLR_RESET;
if (initialHighscore > 0) {
std::cout << "You beat your old record of " << CLR_SCORE << initialHighscore << CLR_RESET
<< " by " << CLR_NORM << (score - initialHighscore) << CLR_RESET << " points!\n";
} else {
std::cout << "First record set! Great job!\n";
}
}
std::cout << "Thanks for playing!\n";
std::cout << "\033[?25h" << std::flush;
Expand Down
Loading