Community Interaction Game

Community Interaction Game preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (Author)

Tags

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.2 • Viewed 98 times • Downloaded 8 times • Run 0 times
Download the 'Community Interaction Game' 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?

Play this game to identify interaction among six mysterious species.

HOW IT WORKS

Agents:

There are six types of agents: species 1, species 2, species 3, species 4, species 5, and species 6.

Model Rules:

  1. There are 192 patches (light blue squares) in the model. The nutrients in each patch may support and only support one plant species.

  2. The plant species regrow every year.

  3. The animal species lose energy when they move around to search for food and die when running out of energy.

  4. The animal species gain energy when they find food and will produce offspring when they accumulate enough energy.

HOW TO USE IT

  1. Click Start/Clear all to start and reset the game.

  2. Use buttons to add in or remove species from the model.

  3. Click Run/Pause to run or pause the model. Good for gaining an overview and a long-term result.

  4. Click Run a year to run the model for a hypothetical year. Good for systematically collecting data.

  5. Use plot-plants? and other similar switches to decide whether or not to plot certain organisms in the real-time plot. Good for providing a clear visualization.

THINGS TO TRY

  • Can you draw a food web among the six species?

RELATED MODELS

Find more community interaction models at http://3dsciencemodeling.com

CREDITS AND REFERENCES

Dr. Lin Xiang (lin.xiang@uky.edu) created this module at the University of Kentucky in 2022. If you mention this model in a publication, we ask that you include the citations below.

Xiang, L. (2022). Community Interaction Game. Department of STEM Education, University of Kentucky, Lexington, KY.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

; Coded in 2022 by Lin Xiang; Last revised in 2022 by Lin Xiang (lxiang75@gmail.com; lin.xiang@uky.edu)
;;
;; If you mention this model in a publication, we ask that you include the citations below.
;;
;; Xiang, L. (2022). Community Interaction Game. Department of STEM Education, University of Kentucky, Lexington, KY.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



breed [plant1s plant1]
breed [plant2s plant2]
breed [legends legend]
breed [animal1s animal1 ]
breed [animal2s animal2 ]
breed [animal3s animal3 ]
breed [animal4s animal4 ]


plant1s-own [visit-1 num-seed-1 erg-0]
plant2s-own [visit-2 num-seed-2 erg-00]
animal1s-own [erg-1 day-1]
animal2s-own [erg-2 day-2]
animal3s-own [erg-3 day-3]
animal4s-own [erg-4 day-4]
Globals [
  running-avg-list1  running-avg-list2 running-avg-list-plant
  running-avg-lists1  running-avg-lists2 running-avg-list-splant

  mean-total-1 mean-total-2 mean-total-plant
  mean-total-s1 mean-total-s2 mean-total-splant ]

to-report empty-patches
  report patches with [pcolor <= 89.5 and pcolor >= 89 and not any? plant1s-here and not any? plant2s-here]
end 

to setup
  clear-all

  setup-patches
  setup-legends


  set running-avg-list1 []
  set running-avg-list2 []
  set running-avg-list-plant []

  set running-avg-lists1 []
  set running-avg-lists2 []
  set running-avg-list-splant []


  reset-ticks
end 

to setup-patches
  ask patches [set pcolor 89 + random-float 0.5]
  ask patches with [ pycor < 2 or pycor = max-pycor ] [set pcolor white]
end 

;;;;;;;;;;;;;;;;;;;;;
;;   GO PROCEDURE  ;;
;;;;;;;;;;;;;;;;;;;;;

to go
  every 0.05[
  if ticks >= years: [stop]
  move
  (ifelse
      any? animal3s and not any? animal1s
       [feeding-3]
      any? animal1s and not any? animal3s
       [feeding-1]
      any? animal3s and any? animal1s
        [ifelse random 2 = 0
          [feeding-1 feeding-3]
          [feeding-3 feeding-1]]
   )

 (ifelse
      any? animal2s and not any? animal4s
       [feeding-2]
      any? animal4s and not any? animal2s
       [feeding-4]
      any? animal2s and any? animal4s
        [ifelse random 2 = 0
          [feeding-2 feeding-4]
          [feeding-4 feeding-2]]
   )

(ifelse
      any? plant1s and not any? plant2s
       [plant-grow]
      any? plant2s and not any? plant1s
       [plant-grow-1]
      any? plant1s and any? plant2s
       [ifelse random 2 = 0
          [plant-grow plant-grow-1]
          [plant-grow-1 plant-grow]]
   )

 winter

  find-running-avg-1

    tick
  ]
end 

to move
  if any? animal1s [ask animal1s [ifelse day-1 >= 10 [die] [set day-1 day-1 + 1]
    right random 360 if [pcolor] of patch-at dx dy <= 89.5 and [pcolor] of patch-at dx dy >= 89 [fd 1 if ycor < 2 [set ycor 2] set erg-1 erg-1 - 1] if erg-1 <= 0 [die]]]
  if any? animal2s [ask animal2s [;ifelse day-2 >= 20 [die] [set day-2 day-2 + 1]
    right random 360 if [pcolor] of patch-at dx dy <= 89.5 and [pcolor] of patch-at dx dy >= 89 [fd 1 if ycor < 2 [set ycor 2] set erg-2 erg-2 - 1] if erg-2 <= 0 [die]]]
  if any? animal3s [ask animal3s [ifelse day-3 >= 12 [die] [set day-3 day-3 + 1]
    right random 360 if [pcolor] of patch-at dx dy <= 89.5 and [pcolor] of patch-at dx dy >= 89 [fd 1 if ycor < 2 [set ycor 2] set erg-3 erg-3 - 1] if erg-3 <= 0 [die]]]
  if any? animal4s [ask animal4s [;ifelse day-4 >= 20 [die] [set day-4 day-4 + 1]
    right random 360 if [pcolor] of patch-at dx dy <= 89.5 and [pcolor] of patch-at dx dy >= 89 [fd 1 if ycor < 2 [set ycor 2] set erg-4 erg-4 - 1] if erg-4 <= 0 [die]]]
end 

to feeding-1
 ask animal1s [   ;feed
    if any? plant1s-here [
      let food one-of plant1s-here
      set erg-1 erg-1 + [erg-0] of food
      ask food [die]]]

  ask animal1s [if random 100 < 95   ;reproduce
    [if erg-1 > 20 [
      hatch 1 [set erg-1 10 set day-1 0]
      set erg-1 erg-1 - 10]]]
end 

to feeding-3
 ask animal3s [   ;feed
    if any? plant1s-here [
      let food one-of plant1s-here
      set erg-3 erg-3 + [erg-0] of food
      ask food [die]]]

  ask animal3s [if random 100 < 95   ;reproduce
    [if erg-3 > 20 [
      hatch 1 [set erg-3 10 set day-3 0]
      set erg-3 erg-3 - 10]]]
end 

to feeding-2
 ask animal2s [    ;prey
    if any? animal1s-here [
      let food one-of animal1s-here
      set erg-2 erg-2 + [erg-1] of food
      ask food [die]]]

   ask animal2s [ if random 100 < 55      ;reproduce
    [if erg-2 > 40
      [hatch 1 [set erg-2 20 set day-2 0]
        set erg-2 erg-2 - 20]]]
end 

to feeding-4
 ask animal4s [             ;prey
    if any? animal1s-here [
      let food one-of animal1s-here
      set erg-4 erg-4 + [erg-1] of food
      ask food [die]]

   if any? animal3s-here [
      let food one-of animal3s-here
      set erg-4 erg-4 + [erg-3] of food
      ask food [die]]]

   ask animal4s [ if random 100 < 55      ;reproduce
    [if erg-4 > 40
      [hatch 1 [set erg-4 20 set day-4 0]
        set erg-4 erg-4 - 20]]]
end 

to plant-grow
 if any? plant1s
    [ask plant1s
     [ask up-to-n-of 1 neighbors with [pcolor <= 89.5 and pcolor >= 89 and not any? plant1s-here and not any? plant2s-here]
      [sprout-plant1s 1
          [set color 55
           set shape "triangle"
           set size 0.6 + random-float 0.4
              set erg-0 10]]]]
end 

to plant-grow-1
if any? plant2s
  [ask plant2s
    [ask up-to-n-of 1 neighbors with [pcolor <= 89.5 and pcolor >= 89 and not any? plant1s-here and not any? plant2s-here]
      [sprout-plant2s 1
        [set color 135
         set shape "sun"
         set size 0.4 + random-float 0.3
          set erg-00 10]]]]
end 

to winter

  if any? plant1s [ask plant1s [if random 100 < 40 [die]]]
  if any? plant2s [ask plant2s [if random 100 < 40 [die]]]
end 

to find-running-avg-1   ;find the running average
   (ifelse
    ticks < 10
    [ifelse any? animal1s [set running-avg-list1 lput (count animal1s) running-avg-list1 set mean-total-1 mean running-avg-list1]
                          [set running-avg-list1 lput 0 running-avg-list1 set mean-total-1 mean running-avg-list1]
      ifelse any? animal2s [set running-avg-list2 lput (count animal2s) running-avg-list2 set mean-total-2 mean running-avg-list2]
                           [set running-avg-list2 lput 0 running-avg-list2 set mean-total-2 mean running-avg-list2]
      ifelse any? plant1s [set running-avg-list-plant lput (count plant1s) running-avg-list-plant set mean-total-plant mean running-avg-list-plant]
                          [set running-avg-list-plant lput 0 running-avg-list-plant set mean-total-plant mean running-avg-list-plant]

      ifelse any? animal3s [set running-avg-lists1 lput (count animal3s) running-avg-lists1 set mean-total-s1 mean running-avg-lists1]
                           [set running-avg-lists1 lput 0 running-avg-lists1 set mean-total-s1 mean running-avg-lists1]
      ifelse any? animal4s [set running-avg-lists2 lput (count animal4s) running-avg-lists2 set mean-total-s2 mean running-avg-lists2]
                           [set running-avg-lists2 lput 0 running-avg-lists2 set mean-total-s2 mean running-avg-lists2]
      ifelse any? plant2s [set running-avg-list-splant lput (count plant2s) running-avg-list-splant set mean-total-splant mean running-avg-list-splant]
                          [set running-avg-list-splant lput 0 running-avg-list-splant set mean-total-splant mean running-avg-list-splant]
     ]

    [ifelse any? animal1s [set running-avg-list1 lput count animal1s running-avg-list1 set running-avg-list1 remove-item 0 running-avg-list1 set mean-total-1 mean running-avg-list1]
                          [set running-avg-list1 lput 0 running-avg-list1 set running-avg-list1 remove-item 0 running-avg-list1 set mean-total-1 mean running-avg-list1]
      ifelse any? animal2s [set running-avg-list2 lput count animal2s running-avg-list2 set running-avg-list2 remove-item 0 running-avg-list2 set mean-total-2 mean running-avg-list2]
                            [set running-avg-list2 lput 0 running-avg-list2 set running-avg-list2 remove-item 0 running-avg-list2 set mean-total-2 mean running-avg-list2]
      ifelse any? plant1s [set running-avg-list-plant lput count plant1s running-avg-list-plant set running-avg-list-plant remove-item 0 running-avg-list-plant set mean-total-plant mean running-avg-list-plant]
                           [set running-avg-list-plant lput 0 running-avg-list-plant set running-avg-list-plant remove-item 0 running-avg-list-plant set mean-total-plant mean running-avg-list-plant]
      ifelse any? animal3s [set running-avg-lists1 lput count animal3s running-avg-lists1 set running-avg-lists1 remove-item 0 running-avg-lists1 set mean-total-s1 mean running-avg-lists1]
                           [set running-avg-lists1 lput 0 running-avg-lists1 set running-avg-lists1 remove-item 0 running-avg-lists1 set mean-total-s1 mean running-avg-lists1]
      ifelse any? animal4s [set running-avg-lists2 lput count animal4s running-avg-lists2 set running-avg-lists2 remove-item 0 running-avg-lists2 set mean-total-s2 mean running-avg-lists2]
                           [set running-avg-lists2 lput 0 running-avg-lists2 set running-avg-lists2 remove-item 0 running-avg-lists2 set mean-total-s2 mean running-avg-lists2]
      ifelse any? plant2s [set running-avg-list-splant lput count plant2s running-avg-list-splant set running-avg-list-splant remove-item 0 running-avg-list-splant set mean-total-splant mean running-avg-list-splant]
                          [set running-avg-list-splant lput 0 running-avg-list-splant set running-avg-list-splant remove-item 0 running-avg-list-splant set mean-total-splant mean running-avg-list-splant]]
  )
end 

to setup-legends

  create-legends 13

  ask legend 0
  [set shape "triangle"
    set size 0.75
    set color 55
    setxy 6.5 0.75]

  ask legend 1
  [set shape "pentagon"
    set color 36
    set size 0.75
    setxy 8.5 0.75]


  ask legend 2
  [set shape "heart"
    set color 25
    set size 0.75
    setxy 10.5 0.75]

  ask legend 3
  [set shape "line"
    set color 8
    set size 11
    set heading 90
    setxy 4.5 1.5]

  ask legend 4
  [set shape "blank"
    set color 136
    set size 1.5
    set label "species5"
    set label-color 0
    set heading 75
    setxy 8.3 0.5]

  ask legend 5
  [set shape "blank"
    set color 136
    set size 1.5
    set label "species4"
    set label-color 0
    set heading 75
    setxy 6.45 0.5]

  ask legend 6
  [set shape "blank"
    set color 136
    set size 1
    set label "species6"
    set label-color 0
    set heading 75
    setxy 10.5 0.25]

 ask legend 7
  [set shape "star"
    set size 0.75
    set color 125
    setxy 0.5 0.75]

   ask legend 8
  [set shape "blank"
    set color 136
    set size 1.5
    set label "species1"
    set label-color 0
    set heading 75
    setxy 0.45 0.5]

   ask legend 9
  [set shape "cloud"
    set color 105
    set size 0.75
    setxy 2.5 0.75]

   ask legend 10
  [set shape "blank"
    set color 136
    set size 1.5
    set label "species2"
    set label-color 0
    set heading 75
    setxy 2.5 0.5]

   ask legend 11
  [set shape "sun"
    set color 135
    set size 0.75
    setxy 4.5 0.75]

   ask legend 12
  [set shape "blank"
    set color 136
    set size 1
    set label "species3"
    set label-color 0
    set heading 75
    setxy 4.75 0.25]
end 

There is only one version of this model, created about 2 years ago by lin xiang.

Attached files

File Type Description Last updated
Community Interaction Game.png preview Preview for 'Community Interaction Game' about 2 years ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.