maximShop
No preview image
Model was written in NetLogo 6.1.1
•
Viewed 89 times
•
Downloaded 7 times
•
Run 0 times
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
globals [ buildings ] turtles-own [ house goal collected-heat age choice-of-transport ] patches-own [ popularity building road green-area temperature sales ] to setup clear-all reset-ticks set buildings (list) ask patches [ set pcolor green set popularity 1 set temperature 0 set sales 0 ] ask patch (random-xcor)(random-ycor) [become-building] create-turtles walker-count [ set xcor random-xcor set ycor random-ycor set house one-of patches set goal one-of patches set color blue set size 2 set collected-heat 1 ] end ;; Click to place buildings ;; Have stuff unbecome path once it decays below a certain popularity threshold to go check-building-placement move-walkers decay-popularity tick end to check-building-placement if mouse-down? [ask patch (round mouse-xcor) (round mouse-ycor) [ ifelse pcolor = red [ unbecome-building ] [ become-building ] ]] end to unbecome-building set pcolor green set popularity 1 set buildings (remove self buildings) set temperature 0 end to become-building set pcolor red set buildings (fput self buildings) set temperature work-temperature end to decay-popularity ask patches with [pcolor != red] [ if popularity > 1 and not any? turtles-here [ set popularity popularity * (100 - popularity-decay-rate) / 100 ] ifelse pcolor = green [ if popularity < 1 [ set popularity 1 ] ] [ if popularity < 1 [ set popularity 1 set pcolor green ] ] ] end to become-more-popular set popularity popularity + popularity-per-step if popularity > minimum-route-popularity [ set pcolor gray ] end to move-walkers ask turtles [ set collected-heat collected-heat + .1 ifelse patch-here = goal [ ifelse pcolor = red [ifelse collected-heat >= temperature [set collected-heat collected-heat - temperature set goal house ask patch-here [set sales sales + 1]] [ifelse coin-flip? [set goal one-of buildings] [set goal one-of patches] ] ] [ifelse coin-flip? [set goal one-of buildings] [set goal one-of patches] ] ] [ walk-towards-goal ] ] end to-report coin-flip? report random 2 = 0 end to walk-towards-goal let last-distance distance goal let best-route-tile route-on-the-way-to goal last-distance ; boost the popularity of the route we're using if pcolor = green [ ask patch-here [become-more-popular] ] ifelse best-route-tile = nobody [ face goal ] [ face best-route-tile ] fd 1 end to-report route-on-the-way-to [l current-distance] let routes-on-the-way-to-goal (patches in-radius walker-vision-dist with [ pcolor = gray and distance l < current-distance - 1 ]) report min-one-of routes-on-the-way-to-goal [distance self] end
There is only one version of this model, created about 3 years ago by Silvana Leiß.
Attached files
No files