Jump to content

Convex Hull

From SELESwiki
Revision as of 20:52, 8 November 2006 by Fei (talk | contribs) (MLM.scn)

Summary

Screenshot

Download Model

Download the .scn, .sel and .lse files by clicking on the following link: File:ConvexHull.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.

MLM.scn

SELES Scenario
$gisData$ = ..\..\CaseStudy_Morice\gisData\cell
StudyArea = $gisData$\BEC
Model Dimensions: StudyArea 
Model.sel
SimPriority Low Priority
//SimStart 100000 1

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:

  1. Vary pInitial and see what affect this has.
  2. Change OVER REGION CENTRED to another value. Try "2". What happes when neighbours can live further away from origin cells?
  3. Change 'numNeighbs EQ 3' to 'numNeighbs EQ 2'; what happens?
  4. Example: changed pInitial to 0.005 and in GameOfLife.lse "CellState = IF (CellState EQ 0) AND (numNeighbs EQ 2) THEN 1"...

File:GameOfLife Gliders.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 landscape.