Pocket Mouse-Fitness

Pocket Mouse-Fitness preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.0 • Viewed 216 times • Downloaded 20 times • Run 0 times
Download the 'Pocket Mouse-Fitness' 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 [mice mouse]
turtles-own [energy labeled order]

globals [x y   ;mouse position
         order-number    ;track labled mice order
         name-1  name-2 name-string
         watched]

to-report time-period
  report ticks / 40
end 

to setup
  clear-all
  setup-mice
  setup-patches
  reset-ticks
end 

to setup-mice
  create-mice Starting-Population-Size
  ask mice [
    set color 31 + random-float (Color-variation / 2)
    set shape "mouse side"
    set size 1.25
    setxy random-xcor random-ycor
    set labeled 0
    set order 0
    set energy 20]

    set order-number 0
end 

to setup-patches
  ask patches [set pcolor Environment-color]
end 

to go
  if years = 0 [user-message "Number of years is needed" stop]
  if ticks > years * 40 [stop]

  if color-heritable? = false [ask mice [set color 31 + random-float 7.5]]
  diff-survival
  move
  forage
  dead
  reproduce
  regrow
  if count mice = 0 [user-message "All mice have died."  Stop]
  tick
end 

to move
  ask mice [rt (random 180)
               fd 1
               set energy energy - 1]
end 

to dead
  ask mice [if energy <= 0 [die]]
end 

to forage
  ask mice [if pcolor = Environment-color [set energy (energy + Energy-gained) set pcolor pcolor - 0.75]]
end 

to reproduce
  ask mice [
    if energy >= 40
    [hatch 1
      [set energy 20
       if random 100 < Color-variation [set color ((color - 1) + random-float 2)]
        if color < 31 [set color 31]
        if color > 38.5 [set color 38.5]]
      set energy energy - 20
      ] ]
end 

to regrow
  ask patches with [pcolor != Environment-color] [set pcolor Environment-color]
end 

to diff-survival
    ask mice [
      if random 2500 < (abs (color - Environment-color) * Number-of-visual-predators * 0.3) [die]
    ]
end 

to pick-mice

  if count mice with [labeled = 1] >= 2 [user-message "Two mice have been labeled. Unlabel the mice first." stop]
  if any? mice = false [user-message "No mice here." stop]


  if mouse-inside? [
    if mouse-down? [
      let test-mouse min-one-of mice [distancexy mouse-xcor mouse-ycor]
      if test-mouse != nobody [
        ask test-mouse [if count mice with [labeled = 1] = 0 and label = "" [set label "A" set labeled 1]      ;label the 1st selected moues as "A"
                        if count mice with [labeled = 1] = 1 and label = "" [set label "B" set labeled 1]      ;label the 1st selected moues as "B"
        ]
  ]]]



  if count mice with [labeled = 1] >= 2 [stop]   ;disable the button when two mice are labelled.
end 

There are 6 versions of this model.

Uploaded by When Description Download
lin xiang over 3 years ago minor adjustment Download this version
lin xiang over 3 years ago Watch and unwatch Download this version
lin xiang over 3 years ago watch a mouse Download this version
lin xiang over 3 years ago Add population control Download this version
lin xiang almost 4 years ago Fit in NetLogo web Window Download this version
lin xiang about 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Pocket Mouse-Fitness.png preview Preview for 'Pocket Mouse-Fitness' about 4 years ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.