Game of Life: Difference between revisions
| (9 intermediate revisions by the same user not shown) | |||
| Line 23: | Line 23: | ||
GameOfLife.sel // This line tells SELES to go and find the correct .sel model file | GameOfLife.sel // This line tells SELES to go and find the correct .sel model file | ||
SimPriority Low Priority // This line priorizes the modelling process versus other tasks your computer has going. | SimPriority Low Priority // This line priorizes the modelling process versus other tasks your computer has going. | ||
// More information on SimPriority can be found | // More information on SimPriority can be found [[Scenario Reference#Simulation control|here]]. | ||
Comments: More... | Comments: More... | ||
| Line 83: | Line 83: | ||
#Change 'numNeighbs EQ 3' to 'numNeighbs EQ 2'; what happens? | #Change 'numNeighbs EQ 3' to 'numNeighbs EQ 2'; what happens? | ||
Through your | Through your experiments, you should have noticed artifacts called <b>gliders</b>. For the screen shot below, I changed pInitial to 0.005 and in GameOfLife.lse "CellState = IF (CellState EQ 0) AND (numNeighbs EQ 2) THEN 1"... | ||
[[Image:GameOfLife_Flyers.jpg]] | [[Image:GameOfLife_Flyers.jpg]] | ||
The left window is zoomed (use right mouse button) so you can see a close-up of several groups of cells that move across this virtual | The left window is zoomed (use right mouse button) so you can see a close-up of several groups of cells that move across this virtual space. (Or, Space? Yes, it looks a bit like that scene from the Empire Strikes Back when the Millenium Falcon escapes from a [http://starwars.wikia.com/images/thumb/5/50/Falcon-destroyer-chase.jpg/400px-Falcon-destroyer-chase.jpg Star Destroyer]. Would you agree that SELES is, potentially, a tool for story boarding SciFi movies? Alternatively, for all you budding Lucas-wannabees, here's another modelling system: [http://www.flickr.com/photos/kaptainkobold/284929921/in/set-1728541/ "No ship that small..."].) | ||
Latest revision as of 02:22, 9 November 2006
Summary
In the 1970s a two-state, two dimensional cellular automaton named Game of Life became very widely known, particularly among the early computing community. Invented by John Conway, and popularized by Martin Gardner in a Scientific American article, its rules are as follows: If a black cell has 2 or 3 black neighbors, it stays black. If a white cell has 3 black neighbors, it becomes black. In all other cases, the cell becomes white. Despite the simplicity of the rule, an impressive diversity of behavior is achieved, fluctuating between apparent randomness and order. One of the most apparent features of the Game of Life is the frequent occurrence of gliders, which are arrangements of cells that essentially move themselves across the grid. (from http://en.wikipedia.org/wiki/Cellular_automaton)
Screenshot
A screenshot of SELES simulator with the two windows of the GameOfLife model. The window on the right shows the initial distribution of live cells. For this example, the probility of initiation (pInitial, see GameOfLife.lse below) was set to 0.05. That is, a random selection of 5% of the cells are given a value of 1 (= "live"). In the left hand window, the NumNeighbs rule in GameOfLife.lse has been fired one time. Since lots of live cells have less than 3 live neighbours, many cells 'die'.
Download Model
Download the .scn, .sel and .lse files by clicking on the following link: File:GameOfLife.zip
Model Code Exploration
In the following sections we will examine all of the model files for this model. Note that instead of downloading the zip file above, you could just copy the text in the boxes below into a text editor and save it with the appropriate name (Section title). Opening the resulting .scn file in the SELES simulator would run this model.
GameOfLife.scn
Scenario Information // This statement in the .scn file begins each and every SELES model
GameOfLife.sel // This line tells SELES to go and find the correct .sel model file
SimPriority Low Priority // This line priorizes the modelling process versus other tasks your computer has going.
// More information on SimPriority can be found here.
Comments: More...
GameOfLife.sel
Seles Model Model Size: 200, 200 Time Units: na Step 1 Landscape Events: GameOfLife.lse Variable-Output View Maps: CellState PrevCellState Output Model Bounds: CellState: 1 PrevCellState: 1 Global Variables: pInitial = 0.05 Output Frequency: 1
Comments: more here...
GameOfLife.lse
/* This file contains a landscape event definition for Conway's Game of Life */
LSEVENT: GameOfLife
DEFINITIONS
LAYER: CellState, PrevCellState
GLOBAL VARIABLE: pInitial
ENDDEF
INITIALSTATE
INITIALSTATE = 1
CellState = IF UNIFORM(0,1) < pInitial THEN 1 ELSE 0
ENDIS
RETURNTIME
RETURNTIME = 1
PrevCellState = CellState
ENDRT
TRANSITIONS
TRANSITIONS = TRUE
numNeighbs = 0
OVER REGION CENTRED(1,1.5, EUCLIDEAN)
DECISION PrevCellState EQ 1
numNeighbs = numNeighbs + 1
ENDFN
CellState = IF (CellState EQ 0) AND (numNeighbs EQ 3) THEN 1
ELSE IF (CellState EQ 1) AND (2 <= numNeighbs <= 3) THEN 1
ELSE 0
ENDTR
Comments: more here...
Suggested Experiments
To explore this cellular automata model further, try the following:
- Vary pInitial and see what affect this has.
- Change OVER REGION CENTRED to another value. Try "2". What happes when neighbours can live further away from origin cells?
- Change 'numNeighbs EQ 3' to 'numNeighbs EQ 2'; what happens?
Through your experiments, you should have noticed artifacts called gliders. For the screen shot below, I changed pInitial to 0.005 and in GameOfLife.lse "CellState = IF (CellState EQ 0) AND (numNeighbs EQ 2) THEN 1"...
The left window is zoomed (use right mouse button) so you can see a close-up of several groups of cells that move across this virtual space. (Or, Space? Yes, it looks a bit like that scene from the Empire Strikes Back when the Millenium Falcon escapes from a Star Destroyer. Would you agree that SELES is, potentially, a tool for story boarding SciFi movies? Alternatively, for all you budding Lucas-wannabees, here's another modelling system: "No ship that small...".)

