Isopod Box Simple

Isopod Box Simple preview image

1 collaborator

Default-person ERIK SCULLY (Author)

Tags

animal behavior 

Tagged by ERIK SCULLY about 7 years ago

biology 

Tagged by ERIK SCULLY about 7 years ago

habitat preference9 

Tagged by ERIK SCULLY about 7 years ago

habitat preferenceP 

Tagged by ERIK SCULLY about 7 years ago

habitat preferenceb 

Tagged by ERIK SCULLY about 7 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.1 • Viewed 491 times • Downloaded 27 times • Run 0 times
Download the 'Isopod Box Simple' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

globals
[
  sand
  soil
  sand-bark
  soil-bark
  preferred
]

to setup
  clear-all
  ;; set colors for substrate and shelter and set sections based on user choices
  ;; set colors for the substrate options
  set sand brown
  set soil gray
  set sand-bark brown + 2
  set soil-bark brown + 3

  ;; next two lines set up section 1 for either sand or soil for section 1
  if section-1 = "sand" [ ask patches with [pxcor >= 0 and pycor >= 31] [ set pcolor sand ]]
  if section-1 = "soil" [ ask patches with [pxcor >= 0 and pycor >= 31] [ set pcolor soil ]]
  ;; next lines set up section-1 for sand + bark
  if section-1 = "sand-bark" [ ask patches with [pxcor >= 0 and pycor >= 31] [ set pcolor sand ]]
  if section-1 = "sand-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 33 and pycor <= 38  ][set pcolor sand-bark]]
  ;; next lines set up section-1 for the soil + bark choice
  if section-1 = "soil-bark" [ ask patches with [pxcor >= 0 and pycor >= 31] [ set pcolor soil ]]
  if section-1 = "soil-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 33 and pycor <= 38  ][set pcolor soil-bark]]

  ;; the next lines set up the sand or soil choices for section 2
  if section-2 = "sand" [ask patches with [pxcor >= 0 and pycor >= 21 and pycor <= 30 ] [ set pcolor sand ]]
  if section-2 = "soil" [ask patches with [pxcor >= 0 and pycor >= 21 and pycor <= 30 ] [ set pcolor soil ]]
  ;; set sand-bark choices for section 2
  if section-2 = "sand-bark" [ask patches with [pxcor >= 0 and pycor >= 21 and pycor <= 30 ] [ set pcolor sand ]]
  if section-2 = "sand-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 23 and pycor <= 28  ][set pcolor sand-bark]]
  ;; set soil-bark choice for section 2
  if section-2 = "soil-bark" [ask patches with [pxcor >= 0 and pycor >= 21 and pycor <= 30 ] [ set pcolor soil ]]
  if section-2 = "soil-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 23 and pycor <= 28  ][set pcolor soil-bark]]

  ;; set conditions for section 3
  if section-3 = "sand" [ask patches with [pxcor >= 0 and pycor >= 11 and pycor <= 20 ] [ set pcolor sand ]]
  if section-3 = "soil" [ask patches with [pxcor >= 0 and pycor >= 11 and pycor <= 20 ] [ set pcolor soil ]]
  ;; set sand-bark choices for section 3
  if section-3 = "sand-bark" [ask patches with [pxcor >= 0 and pycor >= 11 and pycor <= 20 ] [ set pcolor sand ]]
  if section-3 = "sand-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 13 and pycor <= 18  ][set pcolor sand-bark]]
  ;; set soil-bark choice for section 3
  if section-3 = "soil-bark" [ask patches with [pxcor >= 0 and pycor >= 11 and pycor <= 20 ] [ set pcolor soil ]]
  if section-3 = "soil-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 13 and pycor <= 18  ][set pcolor soil-bark]]

  ;; set conditions for section 4
  if section-4 = "sand" [ask patches with [pxcor >= 0 and pycor >= 0 and pycor <= 10] [ set pcolor sand ]]
  if section-4 = "soil" [ask patches with [pxcor >= 0 and pycor >= 0 and pycor <= 10] [ set pcolor soil ]]
  ;; set sand-bark choices for section 4
  if section-4 = "sand-bark" [ask patches with [pxcor >= 0 and  pycor <= 10] [ set pcolor sand ]]
  if section-4 = "sand-bark" [ask patches with [ pxcor >= 11 and pxcor <= 20 and pycor >= 3 and pycor <= 8  ][set pcolor sand-bark]]
  ;; set soil-bark choice for section 3
  if section-4 = "soil-bark" [ask patches with [pxcor >= 0 and pycor <= 10] [ set pcolor soil ]]
  if section-4 = "soil-bark" [ ask patches with [ pxcor >= 11 and pxcor <= 20  and pycor >= 3 and pycor <= 8  ][set pcolor soil-bark]]

;; set preference (preferred) based on user choices
  if prefer = "sand" [ set preferred sand ]
  if prefer = "soil" [ set preferred soil ]
  if prefer = "sand+bark" [ set preferred sand-bark ]
  if prefer = "soil+bark" [ set preferred soil-bark ]

;; generate isopods
 crt isopods [
    setxy random-xcor random-ycor
    set shape "bug"
  ]
      reset-ticks
end 

to go
  ;; determine probability of isopod movement based on movement probability
  if  random-float 1 <= movement-probability [ask turtles with [ [pcolor] of patch-here != preferred ] [ move ]]
  ;; stop simulation if all isopods have reached their preferred substrate
  if not any? turtles with [[ pcolor ] of patch-here != preferred ] [ stop ]
  tick
end 

;; basic isopod movement.  movement is random and they change heading if they encounter a wall

to move
;; changw heading if you run into a wall
  if pxcor = max-pxcor
    [ set heading (  - heading) ]
  if pxcor = min-pxcor
  [ set heading ( - heading ) ]
  if pycor = max-pycor
    [ set heading ( 180 - heading) ]
  if pycor = min-pycor
  [set heading ( 180 - heading ) ]

;; move randomly
  rt random 5
  lt random 5
  fd 5
end 

There is only one version of this model, created about 7 years ago by ERIK SCULLY.

Attached files

File Type Description Last updated
Isopod Box Simple.png preview Preview for 'Isopod Box Simple' about 7 years ago, by ERIK SCULLY Download

This model does not have any ancestors.

This model does not have any descendants.