natsel

No preview image

1 collaborator

Default-person Pratim Sengupta (Author)

Tags

(This model has yet to be categorized with any tags)
Model group sced2690 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0beta4 • Viewed 153 times • Downloaded 22 times • Run 3 times
Download the 'natsel' 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 [predators predator]
breed [bugs bug]
bugs-own [bigness]

to setup
  ca
  create-bugs 30
  ask bugs [setxy random-xcor random-ycor
    set heading 0
    set color white
    set size 1
    set shape Type-of-organism]
ask n-of 5 bugs with [color = white] [set color red]
ask n-of 5 bugs with [color = white][set color blue]
ask n-of 5 bugs with [color = white] [set color green]
ask n-of 5 bugs with [color = white] [set color violet]
ask n-of 5 bugs with [color = white] [set color yellow]
ask n-of 5 bugs with [color = white] [set color brown]
 set-size
   
  create-predators 1 [
    set shape "bird"
    set color yellow
    set size 3
    set heading 315  ]
  reset-ticks
end 

to set-size
  ask bugs [set bigness random 10]
  ask bugs [set size bigness] 
end 

to reproduce
  ask bugs [
    if random 100 > 25 [
      hatch 1 [setxy random-xcor random-ycor
        set heading 0
        ifelse random 10 > 5 
        [set size size + .5 ]
        [set size size - .5]]]]
end 

to move-predator
  ask predators [
    setxy mouse-xcor mouse-ycor
    set hidden? not mouse-inside?
  ]
end 

to go
tick 
  check-caught
  move-predator
  ask bugs [if size <= .05[die]]
  if count bugs < 10 [user-message (word "There are " count bugs " bugs. Hit Halt and Reproduce before continuing")]
end   

to check-caught
  if not mouse-down? or not mouse-inside? [ stop ]
  let prey [bugs in-radius (size / 3 )] of one-of predators
  ;; no prey here? oh well
  if not any? prey [ stop ]
  ;; eat only one of the bugs at the mouse location
  ask one-of prey [
    die
  ]
end 

There is only one version of this model, created almost 13 years ago by Pratim Sengupta.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.