fishy fish

fishy fish preview image

1 collaborator

Default-person sage sasaki (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.0 • Viewed 88 times • Downloaded 10 times • Run 0 times
Download the 'fishy fish' 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

breed [foods food]
breed [fishies fish]


foods-own [nibbles]

to setup
  clear-all
  create-fishies number-of-fishies

  ask fishies [ set shape "fish" ]
  ask foods [ set shape "dot" ]
  ask fishies [setxy random-xcor random-ycor]
  ask fishies [if ycor > 8 [die]]
  ask fishies [if ycor < -13 [die]]
  ask patches [if pycor < 10 [set pcolor blue]]
  ask patches [if pycor < -13 [set pcolor brown]]
  ask patches [if pycor > 8 [set pcolor white]]
  ask patches [if pycor > 13 [if pxcor < -13 [set pcolor yellow]]]
  ask fishies [set heading 90]

  ask patches [
    if night-effect and ( pycor > 8 )
    [ set pcolor black
      if pycor > 13 [if pxcor < -13 [set pcolor white]]




    ]
  ]




  reset-ticks
end 

to go
  ask fishies [forward .1]
  gofaster
  GoTowardsfishies
  ;reproduce
  placefishies
  eatme

  tick
end 

to gofaster
  ask fishies with [color = red ] [forward .11]
  ask fishies with [color = green ] [forward .09]
  ask fishies with [color = blue ] [forward .095]
  ask fishies with [color = yellow ] [forward .105]
end 

to GoTowardsfishies
  if mouse-down? [stop]
end 

;to reproduce
 ; ask fishies [
  ;  if count fishies-on neighbors = 0
   ; [hatch 1 [setxy random xcor random ycor]]]

;end

to placefishies
  if mouse-down? [
    create-foods 1 [
      set nibbles food-energy
      set shape "dot"

      setxy mouse-xcor mouse-ycor]]
  ask foods [
    if ycor < -14 [die]
    if ycor > 8 [die]
  ]
  ask foods [set heading 180 fd .1]
end 

to eatme

  ask foods[

    ask fishies in-radius 3 [face myself fd .03 ]
    if xcor < -13 [die]


    if nibbles <= 0 [die]

  ]

  ask fishies [
    if ycor < random-ycor [set heading 90 fd .035]
    if ycor < -12 [set heading 90 fd .035]
    if ycor > 7 [set heading 90 fd .035]
    if (count foods in-radius 1 > 0)[ask one-of foods in-radius 1 [set nibbles nibbles - 1]]




  ]
end 





;things that i need to do:
;   -reproduce
;   -make them die when they dont eat
;   -make them regain energy when they eat
;   -place fishies

There is only one version of this model, created about 5 years ago by sage sasaki.

Attached files

File Type Description Last updated
fishy fish.png preview Preview for 'fishy fish' about 5 years ago, by sage sasaki Download

This model does not have any ancestors.

This model does not have any descendants.