Fishies With Shark

No preview image

1 collaborator

Default-person Jacy Cough (Author)

Tags

ecology 

Tagged by Tim Denton almost 13 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1 • Viewed 908 times • Downloaded 54 times • Run 5 times
Download the 'Fishies With Shark' 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 section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

:-)

Jacy made this model with Dad.

Posted over 14 years ago

Click to Run Model

breed [fishies fishie]
breed [sharkies sharkie]

fishies-own [scared]

to setup
  ca
  ask patches [ set pcolor blue ]
  create-fishies 500 [     
    set-fish-defaults   
    setxy random-xcor random-ycor
  ]
  reset-ticks
end   

to set-fish-defaults ;; fish proc
  set size 1.5
  set color orange
  set scared false
  set shape "fishie"
end 

to make-shark
  create-sharkies 1 [
    set size 10
    set color gray       
    set shape "sharkie open"
    setxy random-xcor random-ycor
    set heading 90
  ]
end 

to go
  every 0.5 [ ask sharkies [ change-shape ] ] 
  ask sharkies [
    if not any? fishies in-cone 10 30 [ rt 1 ]
    ask fishies-on patch-at-heading-and-distance heading 5 [ die ]
    fd shark-speed
  ]
  ask fishies [
    let theshark one-of sharkies in-radius fish-vision
    ifelse theshark != nobody [
      set scared true
      face theshark
      rt 180
      fd scared-fish-speed
    ][set scared false]
    ifelse scared [set color red ] [ set color orange ]
    wiggle
    if not scared [
      if any? fishies-here with [not scared] [
        if random 1000 < 1 [ 
          hatch 1 [
            set-fish-defaults
            setxy xcor ycor
          ]
        ]
      ]
    ]
    fd fish-speed
  ]
  tick
end 

to change-shape ;; sharkie procedure
  set shape ifelse-value (shape = "sharkie open") ["sharkie closed"] ["sharkie open" ]
end 

to wiggle        ;; turtle procedure
  rt random 40 - random 40
end 

There is only one version of this model, created over 14 years ago by Jacy Cough.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.