diff --git a/.Jules/palette.md b/.Jules/palette.md index c4e3778..853ef9c 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -25,3 +25,7 @@ ## 2026-03-02 - Hiding the Cursor in CLI Games **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. **Action:** Always hide the cursor for interactive CLI games and explicitly restore it across all exit paths, including async-signal-safe signal handlers. + +## 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. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5990d9c..eed4a5a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,11 @@ version: 2 updates: - - package-ecosystem: "" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "cargo" + directory: "/" schedule: interval: "weekly" diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..c9b45c1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,32 @@ +# Code Code of Conduct + +Like the technical community as a whole, the Code team and community is made up of a mixture of professionals and volunteers from all over the world, working on every aspect of the mission - including mentorship, teaching, and connecting people. + +Diversity is one of our huge strengths, but it can also lead to communication issues and unhappiness. To that end, we have a few ground rules that we ask people to adhere to. This code applies equally to founders, mentors and those seeking help and guidance. + +This isn’t an exhaustive list of things that you can’t do. Rather, take it in the spirit in which it’s intended - a guide to make it easier to enrich all of us and the technical communities in which we participate. + +This code of conduct applies to all spaces managed by the Code project or repositories.. This includes IRC, the mailing lists, the issue tracker, DSF events, and any other forums created by the project team which the community uses for communication. In addition, violations of this code outside these spaces may affect a person's ability to participate within them. + +If you believe someone is violating the code of conduct, we ask that you report it by emailing [aidasofialily@gmail.com](mailto:aidasofialily@gmail.com). For more details please see our [Reporting guidelines](https://docs.github.com/articles/reporting-abuse-or-spam) + +- **Be friendly and patient.** +- **Be welcoming.** We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability. +- **Be considerate.** Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language. +- **Be respectful.** Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the Code community should be respectful when dealing with other members as well as with people outside the Code community. +- **Be careful in the words that you choose.** We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to: + - Violent threats or language directed against another person. + - Discriminatory jokes and language. + - Posting sexually explicit or violent material. + - Posting (or threatening to post) other people's personally identifying information ("doxing"). + - Personal insults, especially those using racist or sexist terms. + - Unwelcome sexual attention. + - Advocating for, or encouraging, any of the above behavior. + - Repeated harassment of others. In general, if someone asks you to stop, then stop. +- **When we disagree, try to understand why.** Disagreements, both social and technical, happen all the time and Code is no exception. It is important that we resolve disagreements and differing views constructively. Remember that we’re different. The strength of Code comes from its varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes. + +Original text courtesy of the [Speak Up! project](http://web.archive.org/web/20141109123859/http://speakup.io/coc.html). + +## Questions? + +If you have questions, please see [Faq](https://support.github.com/?tags=dotcom-footer). If that doesn't answer your questions, feel free to [contact us](mailto:aidasofialily@gmail.com). diff --git a/src/main.cpp b/src/main.cpp index d2bd49c..af692c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,8 +9,6 @@ #include #include #include -#include -#include // Color and formatting macros for terminal output #define RESET "\033[0m" @@ -68,20 +66,14 @@ int main() { return 1; } + std::cout << "\033[?25l" << std::flush; // Hide cursor + long long highscore = load_highscore(); long long initialHighscore = highscore; long long score = 0; bool hardMode = false; char input; - long long highscore = 0; - std::ifstream infile("highscore.txt"); - if (infile.is_open()) { - infile >> highscore; - infile.close(); - } - - long long score = 0; bool hardMode = false; char input; std::cout << CLR_CTRL << "==========================\n SPEED CLICKER\n==========================\n" << CLR_RESET; if (highscore > 0) { @@ -102,7 +94,7 @@ int main() { } for (int i = 3; i > 0; --i) { - std::cout << "\rStarting in " << i << "... " << std::flush; + std::cout << "\rStarting in " << CLR_CTRL << i << CLR_RESET << "... " << std::flush; auto start_wait = std::chrono::steady_clock::now(); while (std::chrono::duration_cast(std::chrono::steady_clock::now() - start_wait).count() < 1000) { int elapsed = std::chrono::duration_cast(std::chrono::steady_clock::now() - start_wait).count(); @@ -116,7 +108,7 @@ int main() { } } } - std::cout << "\rGO! \n" << std::flush; + std::cout << "\r" << CLR_NORM << "GO! " << CLR_RESET << "\n" << std::flush; std::this_thread::sleep_for(std::chrono::milliseconds(200)); tcflush(STDIN_FILENO, TCIFLUSH); @@ -132,7 +124,10 @@ int main() { if (poll(fds, 1, remaining) > 0) { if (read(STDIN_FILENO, &input, 1) <= 0 || input == 'q') break; if (input == 'h') hardMode = !hardMode; - else score++; + else { + score++; + if (score > highscore) highscore = score; + } updateUI = true; } @@ -140,32 +135,27 @@ int main() { elapsed = std::chrono::duration_cast(now - last_tick).count(); if (elapsed >= timeout_ms) { score++; + if (score > highscore) highscore = score; last_tick = now; updateUI = true; } if (updateUI) { - std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " " + std::cout << "\r" << CLR_SCORE << "Score: " << score << CLR_RESET << " | High: " << highscore << " " << (hardMode ? CLR_HARD "[HARD MODE]" : CLR_NORM "[NORMAL MODE]") - << (score > initialHighscore && initialHighscore > 0 ? " NEW BEST! 🥳" : "") + << (score > initialHighscore ? " NEW BEST! 🥳" : "") << " " << std::flush; updateUI = false; } } - if (score > highscore) { - std::ofstream outfile("highscore.txt"); - if (outfile.is_open()) { - outfile << score; - outfile.close(); - } if (score > initialHighscore) { save_highscore(score); } tcsetattr(STDIN_FILENO, TCSANOW, &oldt); std::cout << "\n\n" << CLR_SCORE << "Final Score: " << score << CLR_RESET << "\n"; - if (score > initialHighscore && initialHighscore > 0) { + if (score > initialHighscore) { std::cout << "Congratulations! A new personal best!\n"; } std::cout << "Thanks for playing!\n";