This Python program implements Conway's Game of Life with a Tkinter graphical interface. The Game of Life is a cellular automaton that evolves based on given initial states and simple rules.
- The
Cell
class represents a cell within the game grid. - Each cell can be either dead (
False
) or alive (True
). - Available methods:
is_alive()
,die()
,birth()
.
- The
Grid
class represents the game grid. - Initializes a grid with a given size and initial configuration.
- Counts the number of living neighbors for each cell.
- Updates the grid state according to the rules of the Game of Life.
- Graphical interface created with Tkinter to display the game grid.
- Creates a window with a canvas to display the grid.
- Updates the graphical display at each iteration of the simulation.
- Ensure Python is installed.
- Run the program using
python main.py
. - A window opens displaying the initial grid.
- The simulation starts and evolves according to the rules of the Game of Life.
- Living cells are shown in black, dead cells in white.
main.py
: Contains theCell
,Grid
, andGameOfLifeGUI
classes.seed.py
: Functions for generating a random initial configuration.
This code implements Conway's rules for the Game of Life. The grid is updated at each iteration, changing the state of the cells based on their neighborhood. The initial grid configuration is generated randomly.