Pho Model
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This section could give a general understanding of what the model is trying to show or explain.
HOW IT WORKS
This section could explain what rules the agents use to create the overall behavior of the model.
HOW TO USE IT
This section could explain how to use the model, including a description of each of the items in the interface tab.
THINGS TO NOTICE
This section could give some ideas of things for the user to notice while running the model.
THINGS TO TRY
This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
EXTENDING THE MODEL
This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
NETLOGO FEATURES
This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
RELATED MODELS
This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
CREDITS AND REFERENCES
This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
Comments and Questions
turtles-own[hunger searching eating returning bypassing restaurant-one-x restaurant-one-y] patches-own[capacity taste] to setup ;; setup the environment ca ask patches[ set pcolor white if((pxcor > -7) and (abs(pycor) = 2))[ ;; setup restaurants 1-D for this first model set pcolor green set capacity (12 + random 20) set taste random 100 ] if((pxcor = -7) and (abs(pycor) < 2))[set pcolor 17] ;; setup home base for turtles to live between meals ] crt 5[ setxy -7 0 ;; have the turtles start out at their home base set shape "person" set searching 1 ;; the customers start out searching set heading 90 set hunger 100 ] end to go ask turtles[ check-bypass check-location check-eating check-hunger check-returning check-searching check-waiting ] tick end to check-location ;; check if this is somewhere the turtle wants to eat if(([pcolor] of patch-here = green) and (returning = 0))[ ifelse(random 2 < 1) ;; IMPLEMENT CAPACITY CHECK HERE LATER [set eating 1] ;; if the turtles are on a restaurant and like it, they will stop searching. Otherwise, turn around [set heading (heading + 180) fd .5] ] end to check-eating if(eating = 1)[ set searching 0 set hunger (hunger - 10) ;; while eating, the turtle becomes less hungry if(hunger <= 0)[ set eating 0 ;; no longer hungry set returning 1 if(random 100 < ([taste] of patch-here))[ set restaurant-one-x ([pxcor] of patch-here) ;; have the turtle remember this restaurant if they liked it set restaurant-one-y ([pycor] of patch-here) ] ] ;; when the turtle is no longer hungry, it will return home ] end to check-hunger if(hunger > 100)[ set searching 1 ] set hunger (hunger + 1) ;; every tick the turtle gets more hungry end to check-returning if(returning = 1)[ facexy -7 0 fd .1 if([pcolor] of patch-here = 17)[set returning 0] ] end to check-searching if(searching = 1)[ set heading (heading + (random 45) - (random 45)) ;; have the turtles wiggle, then move forward if(xcor < -6)[set heading 90] ;; if turtle is out of bounds, send them in the right direction fd .1 ] end to check-waiting if(hunger > 100)[set searching 1] ;; if the hunger of the turtles become high, they will start searching for food again end to check-bypass
There is only one version of this model, created about 14 years ago by Taiyo Sogawa.
Attached files
No files