Download presentation
Presentation is loading. Please wait.
1
Conway’s Game of Life Andrew Williams http://www.bolton.ac.uk/staff/adw1
2
Conway’s Game of Life ► Conceptualized in late 1960s ► Popularised in a Scientific American article about John Horton Conway http://tinyurl.com/k2top (URL constructed on 10/10/2007) ► Conway is a mathematician from Liverpool Currently (2007) Professor of Mathematics at Princeton University
3
Conway’s Game of Life ► Really a simulation game A thought-experiment in mathematical terms ► Is it possible to create “life” using a very simple mathematical model? ► What sort of things might this life do?
4
Game of Life “Rules” ► The game is played on a grid of squares In principal, this grid extends infinitely in all directions ► Each cell is either alive (X) or dead ( ) ► There are five living cells in this grid XX XX X
5
Game of Life “Rules” ► Game is played over several generations ► The rules govern how the current population survives to the next generation ► Each cell (living and dead) is considered We look at the eight surrounding cells to determine its fate XX XX X
6
Game of Life “Rules” ► Live cells: If a live cell has 0 or 1 neighbours it dies If it has 2 or 3 neighbours it survives If it has > 3 neighbours it dies ► Dead cells: If a dead cell has exactly three neighbours, they breed and it becomes alive XX XX X
7
Game of Life “Rules” ► Live cells: If a live cell has 0 or 1 neighbours it dies If it has 2 or 3 neighbours it survives If it has > 3 neighbours it dies ► Dead cells: If a dead cell has exactly three neighbours, they breed and it becomes alive XX XX X So, what will happen here?
8
Game of Life “Rules” ► Live cells: If a live cell has 0 or 1 neighbours it dies If it has 2 or 3 neighbours it survives If it has > 3 neighbours it dies ► Dead cells: If a dead cell has exactly three neighbours, they breed and it becomes alive XX X XX
9
Game of Life “Rules” ► Live cells: If a live cell has 0 or 1 neighbours it dies If it has 2 or 3 neighbours it survives If it has > 3 neighbours it dies ► Dead cells: If a dead cell has exactly three neighbours, they breed and it becomes alive XX X XX What about the next generation?
10
Termination ► The game continues until: the population stabilizes or; they all die or; they get into oscillations. XXX X X X An oscillator with period 2
11
Game of Life - Example ► The project called ConwayLife is an implementation of Conway’s Game of Life The simulation happens in LifeBoard.cpp ► The game loop is in lifemain.cpp ► You can load up different starting patterns from lifemain.cpp Pattern files end in.life
12
Game of Life - Tasks 1. Have a play with the system and look at the various patterns provided 2. Use OpenMP to speed up run_one_generation() in LifeBoard.cpp What is the best speed you can achieve?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.