Snakes and Ladders

Snakes and Ladders preview image

4 collaborators

Stefan Dulman (Advisor)
Roger Beeden (Advisor)
Dieter Tracey (Advisor)

Tags

coral reef 

Tagged by Stuart Kininmonth about 12 years ago

ecology 

Tagged by Stuart Kininmonth about 12 years ago

game simulation 

Tagged by Stuart Kininmonth about 12 years ago

marine management 

Tagged by Stuart Kininmonth about 12 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.1 • Viewed 1364 times • Downloaded 56 times • Run 0 times
Download the 'Snakes and Ladders' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


## WHAT IS IT?

This model was set up to provide a working conceptual model of coral reef dynamics in the face of climate change. Climate change threatens a wide range of ecosystem processes that underpin the world's coral reefs. The implementation of conservation actions to manage fishing pressure and water quality has already shown resilience benefits, however ongoing public support is critical to ensure these and future actions can successfully counter the deleterious effects of climate change. Public understanding of resilience theory and the complexity of stochastic events effecting coral reefs is limited, in part, by the model format presented. Here we present a model used as a basis for the simple game known as ‘Snakes and Ladders’ to assist in the understanding of resilience potential and stochastic events in coral reef ecology.

## HOW IT WORKS

The simplicity of the game is the essence of why we selected it. We used a 10 by 10 checkered board numbered sequentially from 1 to 100. The lower numbers represent an unspecified state that is poor (low coral cover or low biodiversity or low resilience) while the higher numbers represent the healthiest state a reef can achieve. Therefore each player’s chip can represent a coral reef within a common region in order to minimize environmental heterogeneity. Each player starts at the lowest number and using the dice values of 1 to 6 precede along the board. With a slight twist on the original game the number of moves required to reach the final square is the measure of success. However the game is complicated by the addition of ‘snakes’ and ‘ladders’ that either accelerate or retard a ‘coral reef’ chip’s progress. Without these complications each ‘coral reef’ chip would take between 17 (17 x 6 moves = 102 squares) and 100 (100 x 1 move =100 squares) moves and winning would simply be a game of lucky dice rolls. With the inclusion of snakes and ladder elements the layout of the board will determine the minimum number of moves possible. Snakes can represent many different processes (over fishing, disease, Acanthuses planci outbreaks, cyclones, thermal bleaching, shipping disaster etc.) that span from retarding growth (perhaps a small magnitude that is less than dice throw) or severely reducing coral reef health (large magnitude). Likewise the ladders can be used to represent a combination of management actions and natural conditions including marine reserves, shipping control, anchoring protection, strong recruitment, and favorable growth conditions etc.

## HOW TO USE IT

The player has the option of firstly selecting the number of snakes and then ladders. The mean size of the snakes/ladders is also altered if desirable. The player can then keep throwing a single dice and watch the movement of the coral reef step by step. Otherwise they can run many thousands of games (as specified) by a click of a button. The outputs show the number of games that were completed with a specified number of dice rolls. Clearly the faster the coral reef can complete a 'game' the more resilient it is to bounce back from disasterous events. Ladders can help here but are often hard to implement in practise. Climate change is rapidly adding more snakes.

## THINGS TO NOTICE

Notice how the coral reefs can end up oscillating at a lower state if the number of snakes is just too many.

## THINGS TO TRY

Try playing with the size of the snakes and ladders.

## EXTENDING THE MODEL

Clearly this model is not trying to inform scientists about the dynamics of coral reef growth but the model could be extended by making the players more adaptable and perhaps more interactive.

## NETLOGO FEATURES

We placed a picture of coral reefs in the background to provide some interesting context. Ideally we would have liked better looking snakes and ladders but this proved very difficult to code up.

## CREDITS AND REFERENCES

This model was created from discussons held at the Great Barrier Reef Marine Park Authority in 2012. Lead netlogo coder was Stefan Dulman with some assistance from Stuart Kininmonth. Graphics were the artistic effort of Dieter Tracey and climate change orientation was from Roger Beeden and Stuart Kininmonth. This model is part of an effort to educate the public on climate change. The implications are discussed in a paper titled "Snakes and Ladders: Resilience modeling of coral reef ecosystems for public education " by Kininmonth, Stuart, Beeden, Roger , Dulman, Stefan & Dieter Tracey pubished in Journal of Environmental Education 2013. Questions concerning the model can be directed at stuart.kininmonth@stockholmresilience.su.se

This model is provided free and without limits to non-profit applications.

Comments and Questions

on line note

just a quick note that this model will need to be downloaded to work since it contains extensions. importantly there is a background image that will be missing. Contact me for a zip file with both (stuart@kininmonth.com.au) but note the Modelling Commons engineers are trying some upgrades to help fix this problem.

Posted over 12 years ago

all up and runing

Thanks to the magnificent efforts of Reuven the model is now working online. Allow some extra time to upload and there will be 2 permissions screens.

Posted over 12 years ago

Click to Run Model

extensions [array bitmap]


;; ----------------------------------------------------------------
breed [helplines helpline]
breed [swarmants swarmant]

globals [
  nrows
  ncols
  posturtle
  steps
  meanvalue
  unfinishedvalue
  vstd
  timeout 
]
patches-own [jumpv]
swarmants-own [antpos]
helplines-own [temp2]

;; ----------------------------------------------------------------

;; startup definition

to startup
  
  __clear-all-and-reset-ticks
  
  set nladders 10
  set nsnakes 10
  set nrows 10
  set ncols 10
  
  ; define world size
  set-patch-size 30
  resize-world 0 (nrows + 1) 0 (ncols + 1)
  bitmap:copy-to-drawing (bitmap:import "board.jpg") 0 0

  set meanvalue 0
  set unfinishedvalue 0

  set vstd 3
  set timeout 1000
  
  ;set showunfinishedgames true
  
  reset-ticks
end 

;; ----------------------------------------------------------------

;; generate snakes and ladders - on a square grid

to generatesnakesladders
  
  ; pick the heads of snakes and ladders
  let temp shuffle filter [? > 0] n-values (nrows * ncols - 1) [?]
  let lheads sublist temp 0 nladders
  let sheads sublist temp nladders (nladders + nsnakes)

  set-default-shape helplines "dot"
  create-helplines 1
  
  ; compute the falls
  foreach sheads [
    ask patch (1 + getcolfromindex ?) (1 + getrowfromindex ?) [
      
      let adjmean averagelength
      let adjstd vstd
      if (averagelength + 3 * vstd) > ? [
        let k ? / (averagelength + 3 * vstd)
        set adjmean averagelength * k
        set adjstd vstd * k
      ]
      
      let a round random-normal adjmean adjstd
      while [a > ?] [
        set a round random-normal adjmean adjstd  
      ]
      if a <= 0 [set a 1]

      set jumpv ? - 1 * a

      ;; draw the line
      ask helplines [
        move-to myself
        set temp2 [jumpv] of myself
        set color [255 0 0]
        set pen-size 9
        set size 1.3
        stamp
        pen-down
        setxy (1 + getcolfromindex temp2) (1 + getrowfromindex temp2)
        pen-up
      ]
      
      ;; draw the line
      ask helplines [
        move-to myself
        set temp2 [jumpv] of myself
        set color [255 255 255]
        set pen-size 3
        set size 0.8
        stamp
        pen-down
        setxy (1 + getcolfromindex temp2) (1 + getrowfromindex temp2)
        pen-up
      ]
    ]
  ]
  
  
    ; compute the jumps
  foreach lheads [
    ask patch (1 + getcolfromindex ?) (1 + getrowfromindex ?) [
      
      let adjmean averagelength
      let adjstd vstd
      if (averagelength + 3 * vstd + ?) > nrows * ncols [
        let k (nrows * ncols - ?) / (averagelength + 3 * vstd)
        set adjmean averagelength * k
        set adjstd vstd * k
      ]
      
      let a round random-normal adjmean adjstd
      while [( a + ? ) >= (nrows * ncols)] [
        set a round random-normal adjmean adjstd
      ]
      
      ;if ( a + ? ) >= (nrows * ncols) [ set a (nrows * ncols) - ? - 1]
      if a <= 0 [set a 1]
      set jumpv ? + a
      
      ;; draw the line
      ask helplines [
        move-to myself
        set temp2 [jumpv] of myself
        set color [0 0 0]
        set pen-size 10
        pen-down
        setxy (1 + getcolfromindex temp2) (1 + getrowfromindex temp2)
        pen-up
      ]
      
      ask helplines [
        move-to myself
        set temp2 [jumpv] of myself
        set color [255 255 255]
        set pen-size 3
        pen-down
        setxy (1 + getcolfromindex temp2) (1 + getrowfromindex temp2)
        pen-up
       
      ]
    ]
  ]
end 


;; ----------------------------------------------------------------



;; ----------------------------------------------------------------
;; get the column coordinate from an index

to-report getcolfromindex [index] 
    let row getrowfromindex index
    ifelse (row mod 2) = 0 [
      ;; we are counting from left to right
      report index mod ncols
    ] [
      ;; we are counting from right to left
      report ncols - 1 - (index mod ncols)
    ]
end 

;; get the row coordinate from an index

to-report getrowfromindex [index] 
    report floor (index / ncols)
end 

;; ----------------------------------------------------------------

to rolldice
  
  set steps steps + 1
  
  ;; roll the dice
  let dice (1 + random 6)
  
  ;; advance the turtle
  set posturtle posturtle + dice
  
  ;; check if we are done
  ifelse posturtle >= (ncols * nrows - 1) [
    show (word "simulation done. number of steps: " steps)
    set posturtle 0
  ] [
    ;; account for ladders and snakes
    set posturtle [jumpv] of patch (1 + getcolfromindex posturtle) (1 + getrowfromindex posturtle)
  ]
  
  ;; update the heading of the turtle
  let row getrowfromindex posturtle
  ifelse (row mod 2) = 0 [
    ask turtles [set heading 90]
  ] [
    ask turtles [set heading 270]
  ]
  if posturtle = (ncols * nrows - 1) [
    ask turtles [set heading 0]
  ]

  ;; update the position of the turtle
  ask turtles [set xcor 1 + getcolfromindex posturtle]
  ask turtles [set ycor 1 + getrowfromindex posturtle]
  
  ;; update the display
  show (word "dice roll: " dice)
  show (word "position: " posturtle)
  show ""
end 

;; ----------------------------------------------------------------

;; setup button

to setup
  
  __clear-all-and-reset-ticks
  
  let i 0
  
  set nrows 10
  set ncols 10
  ; define world size
  set-patch-size 30
  resize-world 0 (nrows + 1) 0 (ncols + 1)
  bitmap:copy-to-drawing (bitmap:import "board.jpg") 0 0

  set steps 0
  
  ;set showunfinishedgames true
  set vstd 3
  set timeout 1000
  
  clear-patches
  
  ;; fill in the default values
  foreach n-values (nrows * ncols) [?] [
    ask patch (1 + getcolfromindex ?) (1 + getrowfromindex ?) [set jumpv ?]
  ]
    
  clear-output
  
  ;; generate a new setup
  generatesnakesladders
  
  ;; place a turtle at the origin
  set posturtle 0
  
  ask turtles [die]
  create-turtles 1
  ask turtles [
    setxy 1 1
    set heading 90
    set color yellow
  ]
end 

;; ----------------------------------------------------------------

;; function generates a bunch of ants and runs statistics

to runswarm
  
  let clock 0
  let i 0
  let statexit []
  
  clear-all-plots
  reset-ticks
  
  ; clear additional variables
  set meanvalue 0
  set unfinishedvalue 0
  
  ; disable display
  no-display
  
  create-swarmants ngames
  ask swarmants [
    set antpos 0
  ]
  
  while [clock < timeout] [
    
    ask swarmants [
      
      ;; roll the dice
      let dice (1 + random 6)
  
      ;; advance the ant
      set antpos antpos + dice
  
      ;; check if we are done
      ifelse antpos >= (ncols * nrows - 1) [
        ;; record the statistics
        set statexit lput clock statexit
        die
      ] [
        ;; account for ladders and snakes
        set antpos [jumpv] of patch (1 + getcolfromindex antpos) (1 + getrowfromindex antpos)
      ]
      
    ]
    
    set-current-plot "Number of Finished Games versus Number of Rolls"
    ifelse empty? statexit [
    ] [
      set-plot-x-range 1 last statexit
      histogram statexit
    ]
    
    set clock clock + 1
    tick
  ]
  
  ;; update variables
  ifelse length statexit = 0 [
    set meanvalue 0 
  ] [
    set meanvalue mean statexit
  ]
  
  ; update the unfinished games variable
  set unfinishedvalue unfinishedvalue + count swarmants
  
  set-current-plot "Number of Finished Games versus Number of Rolls"
  set-plot-x-range 1 (timeout + 1)
  histogram statexit
  
  ;; kill all ants
  ask swarmants [die]
  
  ; enable the display again
  display
end 

There is only one version of this model, created over 12 years ago by Stuart Kininmonth.

Attached files

File Type Description Last updated
board.jpg jpeg background image over 12 years ago, by Stuart Kininmonth Download
Snakes and Ladders.png preview Preview for 'Snakes and Ladders' over 12 years ago, by Stuart Kininmonth Download

This model does not have any ancestors.

This model does not have any descendants.