Project 01: Conway’s Game of Life
Outline
- Program Introduction
- Simulation by Hand
- Program Usage
- Get Started!
Conway’s Game of Life
- 0 player game played on a grid of squares
- Each cell (square) can be alive or dead
- Next step/generation determined by current configuration
- each cell has 8 neighbors
- whether a cell is dead or alive in next generation depends on number of alive neighbors
Your Task
- Complete implementation of Conway’s Game of Life
- Experiment and find “interesting” initial configurations
The Challenges
- Understand and work with a larger program
- given a lot of code, much of it unfamiliar
- understand structure enough to work with the code
- Implement Life
- Use your program to experiment!
The Rules
“Game” played on square grid of cells
- each cell has 8 neighbors
- cells can be in one of two states: alive or dead
- system evolves in rounds
Each Round
State of each cell in the next round is determined state in this round:
- If cell is alive and 2 or 3 live neighbors, it stays alive
- If cell is dead but has 3 live neighbors, it becomes alive
- Otherwise, cell is dead in next round
Simple Examples I (Red = Alive)
Simple Examples II (Red = Alive)
Using the Program
- Compile and run from terminal
- Terminal usage:
java Life <init file> <no. of generations> <interface: Graphic or Text>
Why do People Like CGoL?
- Simple rules, unexpectedly complex behavior
- Behavior is provably unpredictable
- given two configurations there is no algorithm that determines whether a game started from the first config eventually reaches the second
- Can “program” certain behavior
-
Life can simulate an arbitrary computer program
Initialization File Structure
4 4 // dimensions of board (square)
1 1 // coordinates of alive cells
1 2
2 1
2 2