Cafeteria Model Version 2
Model was written in NetLogo 6.0.2
•
Viewed 181 times
•
Downloaded 16 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
;Author Nida Fatima ; V 1.0 ; jaffrinida@yahoo.com globals [tickCount ] breed [servers server] turtles-own [count-down birth-tick servingtime orderitem ] to setup clear-all setupworld reset-ticks end to setupworld ask patches [ setup-barcounter] ask patches [ setup-path ] ask patches [ setup-tables] ask patches [ setup-chairs] setupserver setup-students end to setupserver set-default-shape servers "person" ;set size 3 ask n-of 3 (patches with [pcolor = blue]) [sprout-servers 1 [set color yellow set size 3 ]] end to setup-path if pycor < 25 and pycor > -25 [ set pcolor red ] if pxcor < 3 and pxcor > -3 [ set pcolor white ] end to setup-barcounter if pycor > 25 and pycor < 30 [ set pcolor blue] ask patch -23 30 [ set pcolor blue] ask patch 23 30 [ set pcolor blue] end to setup-tables ask patch 24 14 [ set pcolor black] ask patch 24 13 [ set pcolor black] ask patch 24 12 [ set pcolor black] ask patch 24 5 [ set pcolor black] ask patch 24 4 [ set pcolor black] ask patch 24 3 [ set pcolor black] ask patch 24 -14 [ set pcolor black] ask patch 24 -13 [ set pcolor black] ask patch 24 -12 [ set pcolor black] ask patch 24 -5 [ set pcolor black] ask patch 24 -4 [ set pcolor black] ask patch 24 -3 [ set pcolor black] ask patch 13 14 [ set pcolor black] ask patch 13 13 [ set pcolor black] ask patch 13 12 [ set pcolor black] ask patch 13 5 [ set pcolor black] ask patch 13 4 [ set pcolor black] ask patch 13 3 [ set pcolor black] ask patch 13 -14 [ set pcolor black] ask patch 13 -13 [ set pcolor black] ask patch 13 -12 [ set pcolor black] ask patch 13 -5 [ set pcolor black] ask patch 13 -4 [ set pcolor black] ask patch 13 -3 [ set pcolor black] ask patch -24 14 [ set pcolor black] ask patch -24 13 [ set pcolor black] ask patch -24 12 [ set pcolor black] ask patch -24 5 [ set pcolor black] ask patch -24 4 [ set pcolor black] ask patch -24 3 [ set pcolor black] ask patch -24 -14 [ set pcolor black] ask patch -24 -13 [ set pcolor black] ask patch -24 -12 [ set pcolor black] ask patch -24 -5 [ set pcolor black] ask patch -24 -4 [ set pcolor black] ask patch -24 -3 [ set pcolor black] ask patch -13 14 [ set pcolor black] ask patch -13 13 [ set pcolor black] ask patch -13 12 [ set pcolor black] ask patch -13 5 [ set pcolor black] ask patch -13 4 [ set pcolor black] ask patch -13 3 [ set pcolor black] ask patch -13 -14 [ set pcolor black] ask patch -13 -13 [ set pcolor black] ask patch -13 -12 [ set pcolor black] ask patch -13 -5 [ set pcolor black] ask patch -13 -4 [ set pcolor black] ask patch -13 -3 [ set pcolor black] end to setup-chairs ask patch 26 14 [ set pcolor yellow] ask patch 26 12 [ set pcolor yellow] ask patch 22 14 [ set pcolor yellow] ask patch 22 12 [ set pcolor yellow] ask patch 26 5 [ set pcolor yellow] ask patch 26 3 [ set pcolor yellow] ask patch 22 5 [ set pcolor yellow] ask patch 22 3 [ set pcolor yellow] ask patch 26 -5 [ set pcolor yellow] ask patch 26 -3 [ set pcolor yellow] ask patch 22 -5 [ set pcolor yellow] ask patch 22 -3 [ set pcolor yellow] ask patch 26 -14 [ set pcolor yellow] ask patch 26 -12 [ set pcolor yellow] ask patch 22 -14 [ set pcolor yellow] ask patch 22 -12 [ set pcolor yellow] ask patch 15 14 [ set pcolor yellow] ask patch 15 12 [ set pcolor yellow] ask patch 11 14 [ set pcolor yellow] ask patch 11 12 [ set pcolor yellow] ask patch 15 5 [ set pcolor yellow] ask patch 15 3 [ set pcolor yellow] ask patch 11 5 [ set pcolor yellow] ask patch 11 3 [ set pcolor yellow] ask patch 15 -5 [ set pcolor yellow] ask patch 15 -3 [ set pcolor yellow] ask patch 11 -5 [ set pcolor yellow] ask patch 11 -3 [ set pcolor yellow] ask patch 15 -14 [ set pcolor yellow] ask patch 15 -12 [ set pcolor yellow] ask patch 11 -14 [ set pcolor yellow] ask patch 11 -12 [ set pcolor yellow] ask patch -26 14 [ set pcolor green] ask patch -26 12 [ set pcolor green] ask patch -22 14 [ set pcolor green] ask patch -22 12 [ set pcolor green] ask patch -26 5 [ set pcolor green] ask patch -26 3 [ set pcolor green] ask patch -22 5 [ set pcolor green] ask patch -22 3 [ set pcolor green] ask patch -26 -5 [ set pcolor green] ask patch -26 -3 [ set pcolor green] ask patch -22 -5 [ set pcolor green] ask patch -22 -3 [ set pcolor green] ask patch -26 -14 [ set pcolor green] ask patch -26 -12 [ set pcolor green] ask patch -22 -14 [ set pcolor green] ask patch -22 -12 [ set pcolor green] ask patch -15 14 [ set pcolor green] ask patch -15 12 [ set pcolor green] ask patch -11 14 [ set pcolor green] ask patch -11 12 [ set pcolor green] ask patch -15 5 [ set pcolor green] ask patch -15 3 [ set pcolor green] ask patch -11 5 [ set pcolor green] ask patch -11 3 [ set pcolor green] ask patch -15 -5 [ set pcolor green] ask patch -15 -3 [ set pcolor green] ask patch -11 -5 [ set pcolor green] ask patch -11 -3 [ set pcolor green] ask patch -15 -14 [ set pcolor green] ask patch -15 -12 [ set pcolor green] ask patch -11 -14 [ set pcolor green] ask patch -11 -12 [ set pcolor green] end to setup-students reset-ticks set-default-shape turtles "person" create-turtles numbofstudents [ set color one-of [blue pink] set ycor random-ycor set heading 90 set birth-tick ticks set count-down waitingtime ; set size 2 ] ask n-of ( int (girlorderperc / 100 * count turtles with [color = pink ])) turtles ; n-of (int (0.30 * count turtles)) turtles [ movetocounter ] ask n-of ( int (boyorderperc / 100 * count turtles with [color = blue ])) turtles [ movetocounter ] end to separate-student if any? other turtles-here [ fd 1 separate-student ] end to go ;movetocounter move-turtles tick if ticks >= 720 [stop] end to move-turtles ask turtles with [color = pink ] [ ;let targ one-of patches with[pcolor = blue] ; if targ != nobody [move-to one-of patches with [not any? turtles-here and pcolor = blue]] ;set label "come to counter" set label "" ifelse pcolor != green [continue] [stay] ; [leave] ; if ycor > 25 [ die ] ] ask turtles with [color = blue ] [ set label "" ifelse pcolor != yellow [continue] [stay] ; [leave] ; ] end To continue lt random 10 rt random 10 fd 2 end to stay set count-down count-down - 1 ;decrement-timer set label count-down if count-down = 0 [ Continue set label "" reset-count-down ] if ticks - birth-tick > 65[ die ] end to reset-count-down set count-down waitingtime end to movetocounter let targ one-of patches with[pcolor = blue] if targ != nobody [move-to one-of patches with [not any? turtles-here and pcolor = blue]] set label "give order" set servingtime avgservingtime set orderitem random 3 end
There is only one version of this model, created over 6 years ago by Nida Fatima.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Cafeteria Model Version 2.png | preview | Preview for 'Cafeteria Model Version 2' | over 6 years ago, by Nida Fatima | Download |
odd-behavior-space 2.pdf | ODD and Behavior Space Experiment | over 6 years ago, by Nida Fatima | Download | |
odd-behavior-space 2.pdf | ODD and Behavior Space Experiment | over 6 years ago, by Nida Fatima | Download |
This model does not have any ancestors.
This model does not have any descendants.