Polarainer
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
breed [polar-bears polar-bear] polar-bears-own [hunting-timer] patches-own [has-ice?] to setup clear-all set-default-shape polar-bears "wolf" ;; Use wolf shape for visibility setup-ice setup-bears reset-ticks end to setup-ice ask patches [ ifelse random-float 100 < initial-ice-percentage [ set pcolor white set has-ice? true ] [ set pcolor blue set has-ice? false ] ] end to setup-bears ;; Create 10 small, 10 medium, and 10 large bears repeat 10 [ create-polar-bears 1 [ set size 0.5 set color white set label "S" setxy random-xcor random-ycor set hunting-timer 5 ] create-polar-bears 1 [ set size 1.0 set color gray set label "M" setxy random-xcor random-ycor set hunting-timer 5 ] create-polar-bears 1 [ set size 1.5 set color black set label "L" setxy random-xcor random-ycor set hunting-timer 5 ] ] end to go if not any? polar-bears [ stop ] shrink-ice move-bears bears-hunt remove-drowned-bears plot-data tick end to shrink-ice ask patches with [has-ice?] [ if random-float 100 < ice-shrink-rate [ set has-ice? false set pcolor blue ] ] end to move-bears ask polar-bears [ rt random 50 - random 50 fd 1 if not can-move? 1 [ rt 180 fd 1 ] ] end to bears-hunt ask polar-bears [ let p patch-here ifelse [has-ice?] of p [ ;; successful hunt set hunting-timer 5 ] [ ;; no ice → reduce hunting timer set hunting-timer hunting-timer - 1 ] ] end to remove-drowned-bears ask polar-bears [ if hunting-timer <= 0 [ let drown-chance 0 if size = 1.5 [ set drown-chance 80 ] ;; large if size = 1.0 [ set drown-chance 40 ] ;; medium if size = 0.5 [ set drown-chance 5 ] ;; small if random-float 100 < drown-chance [ die ] ] ] end to plot-data set-current-plot "Bear Population by Size" set-current-plot-pen "Small" plot count polar-bears with [size = 0.5] set-current-plot-pen "Medium" plot count polar-bears with [size = 1.0] set-current-plot-pen "Large" plot count polar-bears with [size = 1.5] end
There is only one version of this model, created 3 months ago by Rainer Mahidin.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.