Skip to content

Small exercise to recreate Game of Life in the Terminal with Python

Notifications You must be signed in to change notification settings

mikysett/game_of_life-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Game of Life - Python exercise

This is a small project done in order to introduce programming in python to a small group of students.

How to execute the program

  • With the terminal go to the program directory and run the command python game_of_life.py (if needed install python first by following any of the many tutorials available online)
  • By default the program generate a random map of 80x20 cells
  • If you want to use your own map or one of the examples in /maps run the command adding the path to the map at the end (for example python game_of_life.py maps/square.map)
  • For seek of simplicity the code do not handle properly maps that are not correct (and will give strange results in those cases)

The Game of Life

  • The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970 (Wikipedia).
  • There is 4 Rules:
  1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overpopulation.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Useful resources

  • LifeWiki to know everything about Life
  • The Art of Code (Video) is a nice presentation of unsual applications of programming, including Life (at minute 4:20)
  • Golly an open source, cross-platform application for exploring Conway's Game of Life and many other types of cellular automata.

Acknowledgements

  • The big book of small python projects, by Al Sweigart, was a very useful resource both for the choice of the subject than for inspiration for code.
  • Special thanks to Alex for offering me the opportunity to participate to this project.

About

Small exercise to recreate Game of Life in the Terminal with Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages