Rock Scissors Paper Competitive Environment

Rock Scissors Paper Competitive Environment preview image

1 collaborator

Default-person Rashid Mhar (Author)

Tags

algae 

Tagged by Rashid Mhar almost 11 years ago

artificial life 

Tagged by Rashid Mhar almost 11 years ago

game of life 

Tagged by Rashid Mhar almost 11 years ago

rock paper scissors 

"based on the game"

Tagged by Rashid Mhar almost 11 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 687 times • Downloaded 52 times • Run 0 times
Download the 'Rock Scissors Paper Competitive Environment' 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 explores the rock paper scissors strategy of multi organism competition. Numbers are monitored to see if the model enters equilibrium or non-equilibrium state.

HOW IT WORKS

When any two competitor species organisms meet one kills the other on the basis: rock kills scissor, scissor kills paper, paper kills rock.

HOW TO USE IT

View settings allow you to use the pen to draw movements, useful for tracking the changes in movement when behaviour strategies are applied, see the energy level of each agent and set a duration for the model to run, up to 20000 ticks, that can be changed in the settings for the duration slider to a new maximum at any time. Switch off Timed will leave the model to run indefinitely.

World settings is divided into initial settings and variables. Initial settings let you control the starting numbers. First section on variables allows for the setting of the energy input into the system which is used by the organisms to breed.

The next section Turtle Settings has controls for speed which lets you set the base turtle speed then modify it for each species. Reproduction energy again you create a base setting, which can then be modified for each species. Note reproduction sliders have been set up to prevent cost of zero which causes flooding and will hang the model. However this is not code protected, so if the sliders are changed outside of current settings please beware of the danger.

Respawning represents in nature the chance of an organism finding a hiding hole to prevent total extinction. It is currently designed to be equal, the frequency can be set to a high every tick to once every 100 ticks. Respawning can be turned off by setting to zero.

On the right hand of the layout are the monitors and behaviour strategy switches. Strategies coded in include hunt victim species, evade enemy species, avoid enemy species and find food. The suffix letter on the switch corresponds to the species r = rocks, s = scissors and p = papers.

To change the model dynamics you can turn on predation and set an energy gain for the prey organism eaten. This changes the model substantially from the rock paper scissors effectively just being toxic to each other and in that way acting as population control, to feeding off each other and using that energy to increase their population. Use the r-gain, s-gain and p-gain to customise the predation modelling, in that way you can create hunter species that hunt for the energy gained from prey, whilst others just kill their target species without eating them for the energy.

THINGS TO NOTICE

You will notice that without Respawning it is not possible to find a dynamic equilibrium of species, the model leads to domination and mass reproduction of one victor species, though you can't predict which will win out.

If you try selectively setting strategies against each other, like evaders vs hunters and adjust settings to create an evolutionary arms race, it is interesting to see which species actually ends up the winner. From the models I've tested predator strategies needs a substantial return on predation to sustain numbers, this reflects the circular nature of the rock paper scissors competition, since what they hunt is also what makes the environment safer for them.

THINGS TO TRY

The Turtle Settings section lets you change the speed and reproduction abilities of each species. Try to figure out what is advantageous or disadvantageous differences. Try to adjust cost / benefits to reflect investment cost by the species.

Behaviour Strategies section lets you turn on and off strategies of hunting, evading, avoiding and food finding. These strategies do have an order of preference if more than one is turned on, evading as a keep alive strategy has greatest priority and food finding has greater priority than hunting prey species. In this rock paper scissors world, there is actually little advantage to killing prey since they are not food, but it does model a competitive environment in a fashion that causes interesting dynamics.

EXTENDING THE MODEL

A simple development would be to add different respawning rates, however that doesn't seem to offer a great amount of interesting investigation. New behaviours would of course be interesting as would testing different movement patterns, in this model the base movement is in a straight line.

NETLOGO FEATURES

The behaviours are dependent on the NetLogo 'neighbours' primitive which allows the organism agent to investigate the world immediately around it and make a movement decision on it. The order of decision making when switched on in order of priority is: Evade an enemy species, find food and finally hunt a target species.

RELATED MODELS

None searched for.

CREDITS AND REFERENCES

Rashid Mhar email statishun(at)outlook.com

Comments and Questions

Click to Run Model

globals [ colist rockbred rockspawn scissorbred scissorspawn paperbred paperspawn rockkill scissorkill paperkill ]
turtles-own [ energy adjust ]
breed [ rocks rock ]
breed [ papers paper ]
breed [ scissors scissor ]

to setup

  clear-all
  set colist (list random 255 random 255 random 255)
  ask patches
  [
    set pcolor black
  ]
  create-rocks number-rocks
  [
    create "rockblob" red - 1
  ]
  create-papers number-papers
  [
    create "paperblob" lime - 1
  ]
  create-scissors number-scissors
  [
    create "scissorblob" blue - 1
  ]
  reset-ticks
end 

to create [form col]
  set shape form
  setxy random-xcor random-ycor
  right random 360
  set color col
end 

to go
  if (ticks >= duration) and Timed [ stop ]  ;; stop after set duration of ticks
  ask turtles
  [
    ifelse Draw [pendown][pen-erase]
  ]
  resources
  moveall
  feed
  kills
  reproduce
  if respawn-interval > 0 [ respawns ] ;; switch off respawns of interval zero
  tick
end 

to moveall
  if r-hunt [ hunt rocks]
  if s-hunt [ hunt scissors]
  if p-hunt [ hunt papers]
  if r-find [ find rocks ]
  if s-find [ find scissors ]
  if p-find [ find papers ]
  if r-evade [ evade rocks]
  if s-evade [ evade scissors]
  if p-evade [ evade papers]
  if r-avoid [ avoid rocks]
  if s-avoid [ avoid scissors]
  if p-avoid [ avoid papers]
  move rocks rock%
  move scissors scissor%
  move papers paper%
end 

to move [brd var]
  ask brd
  [
    forward 0.01 * speed * (var / 100)
  ]
end 

to kills
  ask papers
  [
    if predation and p-gain [ set energy energy + (count rocks-here) * predation-gain ]
    ask rocks-here
    [
      set rockkill rockkill + 1
      die
    ]
  ]
  ask rocks
  [
    if predation and r-gain [ set energy energy + (count scissors-here) * predation-gain ]
    ask scissors-here
    [
      set scissorkill scissorkill + 1
      die
    ]
  ]
  ask scissors
  [
    if predation and s-gain [ set energy energy + (count papers-here) * predation-gain ]
    ask papers-here
    [
      set paperkill paperkill + 1
      die
    ]
  ]
end 

to resources
  ask patches
  [
    let erg-available random 100
    if (erg-available < energy-input-chance) and (ticks mod energy-input-delay = 0)
    [
      set pcolor black + 1
    ]
  ]
end 

to feed
  ask turtles [
    if pcolor = black + 1 [
      set pcolor black
      set energy energy + 1
    ]
  ifelse show-energy
    [ set label energy ] ;; the label is set to be the value of the energy
    [ set label "" ]     ;; the label is set to an empty text value
  ]
end 

to reproduce
  ask rocks
  [
    set adjust rocks+
  ]
  ask scissors
  [
    set adjust scissors+
  ]
  ask papers
  [
    set adjust papers+
  ]
  ask turtles [
    if energy > (reproduction-energy + adjust)[
      set energy energy - (reproduction-energy + adjust)  ;; take away reproduction-energy for mitosis
      hatch 1 [
        right random 360
      if breed = rocks
      [ set rockbred rockbred + 1 ]
      if breed = scissors
      [ set scissorbred scissorbred + 1 ]
      if breed = papers
      [ set paperbred paperbred + 1 ]
      ]
    ]
  ]
end 

to respawns
  if ticks mod respawn-interval = 0
  [
    create-rocks 1
    [
      create "rockblob" red - 1
      set rockspawn rockspawn + 1
    ]
    create-papers 1
    [
      create "paperblob" lime - 1
      set paperspawn paperspawn + 1
    ]
    create-scissors 1
    [
      create "scissorblob" blue - 1
      set scissorspawn scissorspawn + 1
    ]
  ]
end 

to hunt [brd]
  if brd = rocks
  [
    ask brd
    [
      let found (one-of scissors-on neighbors)
      if found != nobody [set heading towards found]
    ]
  ]
  if brd = scissors
  [
    ask brd
    [
      let found (one-of papers-on neighbors)
      if found != nobody [set heading towards found]
    ]
  ]
  if brd = papers
  [
    ask brd
    [
      let found (one-of rocks-on neighbors)
      if found != nobody [set heading towards found]
    ]
  ]
end 

to evade [brd]
  if brd = rocks
  [
    ask brd
    [
      let found (one-of papers-on neighbors)
      if found != nobody [set heading (towards found + 180)]
    ]
  ]
  if brd = scissors
  [
    ask brd
    [
      let found (one-of rocks-on neighbors)
      if found != nobody [set heading (towards found + 180)]
    ]
  ]
  if brd = papers
  [
    ask brd
    [
      let found (one-of scissors-on neighbors)
      if found != nobody [set heading (towards found + 180)]
    ]
  ]
end 

to avoid [brd]
  if brd = rocks
  [
    ask brd
    [
      let found (one-of scissors-on neighbors)
      if found != nobody [set heading (towards found + 180)]
    ]
  ]
  if brd = scissors
  [
    ask brd
    [
      let found (one-of papers-on neighbors)
      if found != nobody [set heading (towards found + 180)]
    ]
  ]
  if brd = papers
  [
    ask brd
    [
      let found (one-of rocks-on neighbors)
      if found != nobody [set heading (towards found + 180)]
    ]
  ]
end 

to find [brd]
  ask brd
  [
    let found (one-of neighbors with [ pcolor = black + 1 ])
    if found != nobody [set heading towards found]
  ]
end 

to reset
  set rock% 100
  set scissor% 100
  set paper% 100
  
  set rocks+ 0
  set scissors+ 0
  set papers+ 0
end 

There is only one version of this model, created almost 11 years ago by Rashid Mhar.

Attached files

File Type Description Last updated
Rock Scissors Paper Competitive Environment.png preview Preview for 'Rock Scissors Paper Competitive Environment' almost 11 years ago, by Rashid Mhar Download

This model does not have any ancestors.

This model does not have any descendants.