Skip to content

Fix(Convoys_GameofLife): Fix Windows curses crash, screen bounds error, add presets & ANSI fallback (#529) - #530

Open
Prayas340 wants to merge 1 commit into
ndleah:mainfrom
Prayas340:fix/conways-game-of-life-improvements
Open

Fix(Convoys_GameofLife): Fix Windows curses crash, screen bounds error, add presets & ANSI fallback (#529)#530
Prayas340 wants to merge 1 commit into
ndleah:mainfrom
Prayas340:fix/conways-game-of-life-improvements

Conversation

@Prayas340

Copy link
Copy Markdown

Description

This Pull Request refactors and improves the Conway's Game of Life simulation (Convoys_GameofLife):

  • Decouples the simulation rules and grid state into a standalone, testable GameOfLifeEngine.
  • Resolves crashes on Windows when curses is not present by adding an ANSI terminal fallback mode as well as windows-curses documentation in requirements.txt.
  • Adds safe_addstr() to prevent curses.error: addstr() returned ERR when the terminal is resized or when rendering near boundaries.
  • Implements the previously unused pause variable, adding interactive controls for Pause/Resume (Space/p), Single-Step (n), Randomize (r), Clear (c), Wrap toggle (w), and Speed adjustment (f/s).
  • Adds built-in pattern presets: Glider, Blinker, Toad, Beacon, Pulsar, and Gosper Glider Gun (1-5 keys or --preset flag).
  • Adds full CLI automation flags (--cli, --preset, --speed, --rows, --cols, --steps, --no-wrap).
  • Adds an automated unit test suite in test_game_of_life.py (9/9 tests passing).
  • Adds requirements.txt and updates README.md with complete documentation.

Fixes #529

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation Update

Project

  • Your Project Name: Convoys_GameofLife

  • Short Description: Terminal simulation of Conway's Game of Life with curses UI, ANSI terminal fallback, and pattern presets.

Checklist:

  • I have named my files and folder, according to this project's guidelines.
  • My code follows the style guidelines of this project.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have created a helpful and easy to understand README.md, according to the given README_TEMPLATE.
  • My changes do not produce any warnings.
  • Added automated test suite test_game_of_life.py.
  • Added requirements.txt.

…r, add presets & ANSI fallback (ndleah#529)

- Decouple simulation logic into testable GameOfLifeEngine
- Add safe coordinate rendering with safe_addstr() to prevent curses boundary errors
- Implement ANSI terminal fallback mode for running without curses
- Add pattern presets (Glider, Pulsar, Gosper Gun, Blinker, Beacon, Toad)
- Add interactive controls: Pause, Step, Randomize, Clear, Wrap toggle, Speed
- Add CLI argument parsing with argparse
- Add unit test suite in test_game_of_life.py and requirements.txt
- Update README.md with complete documentation and keybindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug & Feature(Convoys_GameofLife): Fix Windows curses crash, screen bounds errors, dead pause var, add presets & ANSI fallback

1 participant