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 @@ -17,3 +17,7 @@
## 2026-02-13 - Tactile Feedback in CLI
**Learning:** In terminal-based games, users expect immediate visual feedback for their actions. Relying on a periodic "tick" to update the UI creates a laggy feel. Using `poll()` with a dynamic timeout allows the application to remain idle yet wake up instantly to process and render user input.
**Action:** Always trigger a UI refresh immediately after processing user input in CLI applications, and use efficient waiting mechanisms (like `poll`) that can be interrupted by input.

## 2024-11-20 - Game Start Flow and User Preparation
**Learning:** Transitioning directly from a menu/instructions screen to active gameplay in time-sensitive games can be jarring. A "Press any key to start" followed by a clear, animated countdown (3-2-1-GO) provides a necessary buffer for the user to reposition their hands and focus. Using `tcflush` after the countdown ensures a fair start by discarding accidental inputs during the wait.
**Action:** Implement a preparation phase (start prompt + countdown) for any interactive CLI game or tool that requires rapid user response.
71 changes: 0 additions & 71 deletions .github/workflows/apisec-scan.yml

This file was deleted.

15 changes: 5 additions & 10 deletions .github/workflows/rust.yml → .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
name: Rust
name: C++ CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
run: make

permissions:
contents: read
- name: Verify
run: (echo ' '; sleep 4; echo 'q') | ./game | grep "Thanks for playing!"
10 changes: 0 additions & 10 deletions Cargo.toml

This file was deleted.

27 changes: 20 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
#include <termios.h>
#include <algorithm>

#define CLR_SCORE "\033[1;32m"
#define CLR_HARD "\033[1;31m"
#define CLR_NORM "\033[1;34m"
#define CLR_CTRL "\033[1;33m"
#define CLR_RESET "\033[0m"

int main() {
struct termios oldt, newt;
tcgetattr(STDIN_FILENO, &oldt);
Expand All @@ -14,12 +20,22 @@ int main() {
tcsetattr(STDIN_FILENO, TCSANOW, &newt);

int score = 0; bool hardMode = false; char input;
std::cout << YELLOW << "==========================\n SPEED CLICKER\n==========================\n" << RESET
<< "Controls:\n " << YELLOW << "[h]" << RESET << " Toggle Hard Mode (10x Speed!)\n "
<< YELLOW << "[q]" << RESET << " Quit Game\n " << YELLOW << "[Any key]" << RESET << " Click!\n\n";
std::cout << CLR_CTRL << "==========================\n SPEED CLICKER\n==========================\n" << CLR_RESET
<< "Controls:\n " << CLR_CTRL << "[h]" << CLR_RESET << " Toggle Hard Mode (10x Speed!)\n "
<< CLR_CTRL << "[q]" << CLR_RESET << " Quit Game\n [Any key] Click!\n\n";
<< CLR_CTRL << "[q]" << CLR_RESET << " Quit Game\n " << CLR_CTRL << "[Any key]" << CLR_RESET << " Click!\n\n";

std::cout << CLR_CTRL << "Press any key to start..." << CLR_RESET << std::flush;
if (read(STDIN_FILENO, &input, 1) <= 0 || input == 'q') {
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
return 0;
}

for (int i = 3; i > 0; --i) {
std::cout << "\r" << CLR_SCORE << "Starting in " << i << "... " << CLR_RESET << std::flush;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
std::cout << "\r" << CLR_SCORE << "GO! " << CLR_RESET << "\n" << std::flush;
tcflush(STDIN_FILENO, TCIFLUSH);

struct pollfd fds[1] = {{STDIN_FILENO, POLLIN, 0}};
auto last_tick = std::chrono::steady_clock::now();
Expand All @@ -46,9 +62,6 @@ int main() {
}

if (updateUI) {
std::cout << GREEN << "Score: " << score << RESET
<< (hardMode ? RED " [FAST] " : BLUE " [NORMAL] ") << RESET
<< " \r" << std::flush;
std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " "
<< (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]")
<< " " << std::flush;
Expand Down