Fish & Plankton for Challenge

Fish & Plankton for Challenge preview image

1 collaborator

Default-person Susan Gibbs (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 151 times • Downloaded 15 times • Run 0 times
Download the 'Fish & Plankton for Challenge' modelDownload this modelEmbed this model

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


ACKNOWLEDGMENT

This model was editted for educational purposes. Pleas ask instructors for credits and referneces of the original model

WHAT IS IT?

What does this model do?

HOW IT WORKS

Can you determine what it does?

HOW TO USE IT

Interact as much as you can to determine how you think it should be used.

THINGS TO NOTICE

What have you noticed about the model?

THINGS TO TRY

Have you tried different settings on the sliders?

RELATED MODELS

???

CREDITS AND REFERENCES

For educational purposes only. Please ask instructors for credits and references of the original model

COPYRIGHT AND LICENSE

Copyright 2007 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

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

Click to Run Model

breed [planktons plankton]
breed [fishes fish]

fishes-own [ energy ]   ;; gives fish the trait of "energy" which can be set & changed in the code

to setup
  clear-all
  ask patches                            ;; color background cyan
    [  set pcolor cyan  ]

  create-planktons 500   ;; this might be a good place to add a slider later
    [
       set heading random 360                ;; random heading
       setxy random-xcor random-ycor         ;; random starting location
       set color green
       set shape "circle"
       set size .75
    ]

  create-fishes number-of-fishes        ;; create the initial number of fishes
    [
      set heading random 360             ;; random heading
      setxy random-xcor random-ycor      ;; random starting location
      set shape "fish"
      set size 2
      set energy 50                      ;; set the initial energy of each fish to 50
    ]
 reset-ticks
end 

to go                             ;; go procedure calls all other procedures
  if not any? fishes [ stop ]     ;; if all the fish are dead, stop the run

  ask planktons
    [ wiggle ]

  ask fishes
   [
     wiggle
     move-cost
     eat
     more-fishes
     check-death
   ]

  more-planktons
  tick
end 

to wiggle                    ;; turn right, then left by a random 0-9, then forward 1
  right random 10
  left random 10
  forward 1
end 

to move-cost
  set energy energy - 1       ;; reduce the fish energy each step
end 

to eat
  if any? planktons-here       ;; if there are plankton on this patch then eat one, plankton dies
  [
    let target one-of planktons-here
    ask target
      [ die ]
    set energy energy + 10    ;; increase fish energy by eating a plankton, this could be a place to add a slider
  ]
end 

to more-fishes  ;; fish can reproduce if they have enough energy, but it will cost them half of their own energy
  if energy > 100
    [
      set energy energy - 50    ;; energy cost of reproduction
      hatch 1 [ set energy 40 ] ;; creates a new agent just like parent with energy set to 40
    ]
end 

to check-death        ;; if energy level is zero or less, the fish dies
 if energy <= 0
  [  die  ]
end 

to more-planktons
  if (random 1 < 10)    ;; there is a 1/10 chance of getting a new plankton at each tick
    [
      create-planktons 1
        [
             setxy random-xcor random-ycor
             set heading random 360
             set color green
             set size 0.75
             set shape "circle"
        ]
    ]
end 

; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created about 4 years ago by Susan Gibbs.

Attached files

File Type Description Last updated
Fish & Plankton for Challenge.png preview Preview for 'Fish & Plankton for Challenge' about 4 years ago, by Susan Gibbs Download

This model does not have any ancestors.

This model does not have any descendants.