Under the Sea🐟

No preview image

1 collaborator

Default-person Olivia Cornteo (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 81 times • Downloaded 7 times • Run 0 times
Download the 'Under the Sea🐟' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

globals [seaweed]
breed [sharks shark]
breed [seals seal]
breed [fishes fish]
patches-own [countdown]

to setup
  clear-all
  ask patches [ set pcolor blue ]
  if seaweed? [
    ask patches [
      set pcolor one-of [green blue]
      if-else pcolor = green
      [ set countdown seaweed-regrowth-time ]
      [set countdown random seaweed-regrowth-time]
    ]
  ]
  set-default-shape sharks "shark"
  create-sharks initial-number-sharks [
    set color gray
    set size 5.5
    set label-color white - 2
    setxy random-xcor random-ycor
  ]

  set-default-shape seals "seal"
  create-seals initial-number-seals [
    set color black
    set size 3.5
    setxy random-xcor random-ycor
  ]

  set-default-shape fishes "fish"
  create-fishes initial-number-fishes [
    set color orange
    set size 2
    setxy random-xcor random-ycor
  ]


  set seaweed count patches with [pcolor = blue]
  reset-ticks
end 

to go
  if not any? turtles [
    stop
  ]

  ask fishes [
    move
    if seaweed? [
      eat-seaweed
    ]
    reproduce-fishes
    lifespan
  ]

  ask seals [
    move
    catch-fish
    reproduce-seals
    lifespan
  ]

  ask sharks [
    move
    catch-seals
    reproduce-sharks
    lifespan
  ]

  if seaweed? [
    ask patches [
      grow-seaweed
    ]
  ]

  set seaweed count patches with [
    pcolor = blue
  ]
  tick
end 

to move
  rt random 50
  lt random 50
  fd 1
end 

to eat-seaweed
  if pcolor = green [
    set pcolor blue
  ]
end 

to reproduce-fishes
  if random-float 100 < fishes-reproduce [
    hatch 1 [
      rt random-float 360 fd 1
    ]
  ]
end 

to reproduce-seals
  if random-float 100 < seals-reproduce [
    hatch 1 [
      rt random-float 360 fd 1
    ]
  ]
end 

to reproduce-sharks
  if random-float 100 < sharks-reproduce [
    hatch 1 [
      rt random-float 360 fd 1
    ]
  ]
end 

to catch-fish
  let prey one-of fishes-here
  if prey != nobody [
    ask prey [
      die
    ]
  ]
end 

to catch-seals
  let prey one-of seals-here
  if prey != nobody [
    ask prey [
      die
    ]
  ]
end 

to lifespan
  let fishpop fishes-here
  let sealpop seals-here
  let sharkpop sharks-here
  if ticks = 50 [
    ask fishpop [
      die
    ]
  ]
  if ticks = 60 [
    ask sealpop [
      die
    ]
  ]
  if ticks = 70 [
    ask sharkpop [
      die
    ]
  ]
end 

to grow-seaweed
  if pcolor = blue [
    ifelse countdown <= 0 [
      set pcolor green
      set countdown seaweed-regrowth-time
    ]
    [
      set countdown countdown - 1
    ]
  ]
end 

There is only one version of this model, created over 7 years ago by Olivia Cornteo.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.