diff --git a/.Jules/palette.md b/.Jules/palette.md index e565b3e..16c5db3 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -8,3 +8,7 @@ ## 2024-05-20 - Dynamic Progress Bar for Quiet CLI Tasks **Learning:** For long-running CLI processes that suppress verbose logging (e.g., `--quiet`), users lose system status visibility. **Action:** Implemented a dynamic progress bar using `\r` and `flush=True`, conditional on `sys.stdout.isatty()`, to provide status feedback without polluting non-interactive logs. + +## 2025-03-05 - C++ CLI Formatting +**Learning:** Using standard ASCII box-drawing characters alongside `` formatting (`setw`) and ANSI color constants creates structured, dashboard-like CLI experiences in C++ applications. Emojis and visual distinctness greatly improve the UX. +**Action:** When summarizing results in C++ CLI tools, utilize this combination to highlight success states and crucial metrics rather than printing basic lists. diff --git a/NumberGuess/NumberGuess.cpp b/NumberGuess/NumberGuess.cpp index c82e2f8..74e9e58 100644 --- a/NumberGuess/NumberGuess.cpp +++ b/NumberGuess/NumberGuess.cpp @@ -2,11 +2,23 @@ #include // For rand() and srand() #include // For time() #include +#include using namespace std; +// ANSI Color Constants for UX +const string RESET = "\033[0m"; +const string BOLD = "\033[1m"; +const string GREEN = "\033[32m"; +const string YELLOW = "\033[33m"; +const string BLUE = "\033[34m"; +const string CYAN = "\033[36m"; +const string RED = "\033[31m"; + + void showEasterEgg() { - cout << "\n[!] EASTER EGG ACTIVATED: THE ZEN MODE" << endl; + cout << "\n" << BOLD << CYAN << "[✨] EASTER EGG ACTIVATED: THE ZEN MODE" << RESET << endl; + cout << "Inspired by the Word 1.1a secret found 29 years later." << endl; cout << "EiJackGH Lab - Saying YES in 2026." << endl; cout << "========================================" << endl; @@ -21,9 +33,9 @@ int main() { int guess = 0; int attempts = 0; - cout << "--- EI-JACK LAB: NUMBER GUESSER V1.0 ---" << endl; + cout << BOLD << BLUE << "--- EI-JACK LAB: NUMBER GUESSER V1.0 ---" << RESET << endl; cout << "I'm thinking of a number between 1 and 100." << endl; - cout << "(Hint: Type 'zen' to see the credits)" << endl << endl; + cout << YELLOW << "(Hint: Type 'zen' to see the credits)" << RESET << endl << endl; while (guess != secretNumber) { cout << "Enter your guess: "; @@ -39,23 +51,30 @@ int main() { try { guess = stoi(input); } catch (...) { - cout << "Invalid input. Please enter a number." << endl; + cout << RED << "⚠️ Invalid input. Please enter a number." << RESET << endl; continue; } attempts++; if (guess > secretNumber) { - cout << ">>> Too high! Try again." << endl; + cout << RED << "📈 Too high! Try again." << RESET << endl; } else if (guess < secretNumber) { - cout << ">>> Too low! Try again." << endl; + cout << BLUE << "📉 Too low! Try again." << RESET << endl; } else { - cout << "\nCONGRATULATIONS!" << endl; - cout << "You found it in " << attempts << " attempts." << endl; + + cout << "\n" << BOLD << GREEN << "╔════════════════════════════════════════╗" << endl; + cout << "║ " << RESET << "🎉 CONGRATULATIONS! 🎉 " << BOLD << GREEN << "║" << endl; + cout << "╠════════════════════════════════════════╣" << endl; + cout << "║ " << RESET << "You found the secret number in: " << setw(4) << attempts << BOLD << GREEN << " ║" << endl; + cout << "╚════════════════════════════════════════╝" << RESET << endl; + } } cout << "----------------------------------------" << endl; - system("pause"); // Essential for Dev-C++ to keep the window open + cout << "\nPress Enter to exit..." << endl; + cin.ignore(10000, '\n'); // Ignore any remaining characters in the buffer + cin.get(); // Wait for the user to press Enter return 0; }