Skip to content

[Color_Game] Fix missing icon crash, relative file path resolution, scoring logic, and add game restart #472

Description

@Prayas340

Description

This issue addresses several bugs, compatibility problems, and usability improvements in the \Color_Game\ project:

  1. Missing Icon Crash: \main.py\ calls \window.iconbitmap("color_game_icon.ico"), but \color_game_icon.ico\ does not exist in the repository, resulting in an unhandled _tkinter.TclError\ exception on startup.
  2. Relative File Path Resolution: \highest_score.txt\ is opened using a relative string without resolving relative to the script directory, causing the score file to be written/read from whichever directory the terminal is in rather than \Color_Game/.
  3. Start Keypress Scoring Evaluation Bug: When the player presses Enter on initial start,
    ext_colour()\ evaluates \e.get()\ against \colours[1]\ before any color text has even been displayed on the screen.
  4. Multiple \Tk()\ Roots: \scoreshow()\ initializes a new \ k.Tk()\ instance alongside the existing root window, causing Tkinter root duplication and resource management issues.
  5. Lack of Replay / Reset Mechanism: Once the timer expires, there was no seamless way to restart the game without terminating and restarting the script.
  6. Incomplete README: \README.md\ was minimal (only 5 lines) and lacked prerequisites, usage instructions, and feature details.

Proposed Fixes

  • Add existence check and safe exception handling for \iconbitmap.
  • Use \os.path.dirname(os.path.abspath(file))\ for dynamic and robust path resolution of \highest_score.txt.
  • Fix the game start and scoring logic so the first Enter starts the timer and displays the first prompt without evaluating unprompted input.
  • Replace secondary \ k.Tk()\ with \messagebox.showinfo\ and provide a replay/reset option.
  • Expand \README.md\ to follow the repository standard documentation format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions