Cafe_version1
No preview image
Model was written in NetLogo 6.0.2
•
Viewed 130 times
•
Downloaded 14 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
breed [persons person] breed [waiters waiter] persons-own[ time_to_leave] patches-own[student-on-table] globals [ available tablem-x tablem-y tablef-x tablef-y ] to setup clear-all set-tables set-chairs student-come set available 0 reset-ticks end to set-tables let table 1 set tablem-x 8 + min-pxcor set tablem-y 7 set tablef-x 24 + min-pxcor set tablef-y 7 while [table < tables ] [ ask patch tablem-x tablem-y [ set pcolor brown set table table + 1 set tablem-y tablem-y + 10 ] ask patch tablef-x tablef-y [ set pcolor brown set table table + 1 set tablef-y tablef-y + 10 ] ] end to set-chairs ask patch 5 28[ set pcolor green ] ask patch 5 26[ set pcolor green ] ask patch 5 18[ set pcolor green ] ask patch 5 16[ set pcolor green ] ask patch 5 8[ set pcolor green ] ask patch 5 6[ set pcolor green ] ask patch 11 28[ set pcolor green ] ask patch 11 26[ set pcolor green ] ask patch 11 18[ set pcolor green ] ask patch 11 16[ set pcolor green ] ask patch 11 8[ set pcolor green ] ask patch 11 6[ set pcolor green ] ask patch 21 28[ set pcolor green ] ask patch 21 26[ set pcolor green ] ask patch 21 18[ set pcolor green ] ask patch 21 16[ set pcolor green ] ask patch 21 8[ set pcolor green ] ask patch 21 6[ set pcolor green ] ask patch 27 28[ set pcolor green ] ask patch 27 26[ set pcolor green ] ask patch 27 18[ set pcolor green ] ask patch 27 16[ set pcolor green ] ask patch 27 8[ set pcolor green ] ask patch 27 6[ set pcolor green ] end to student-come create-persons N [ choose-sex ;; become a man or a woman set size 1.5 setxy 16 0.5 set shape "person" set time_to_leave -1 ] end to choose-sex ;; turtle procedure set color one-of [pink blue] end to go if not any? persons [ stop ] ask persons[ ifelse time_to_leave = -1 [ wiggle direct-way ] [ set time_to_leave time_to_leave - 1 if time_to_leave = 0 [ wiggle die ] ] ] if count persons with [ycor > 2] < N [ create-persons N - count persons with [ycor > 2] [ choose-sex ;; become a man or a woman set size 1.5 setxy 16 0.5 set shape "person" set time_to_leave -1 ] ] tick end to wiggle if pcolor != white and pcolor != brown [ rt random-float 30 lt random-float 30 forward 1 ] if pcolor = brown [ fd 3 ] if pcolor = green [ set pcolor white fd 0 set time_to_leave random Avg-waiting-time ] if pcolor = white and time_to_leave = 0 [ set pcolor green ] end to direct-way if color = blue and xcor >= 16 [ rt 180 ] if color = pink and xcor < 16 [ lt 180 ] end ; ;to seat-available? ; ifelse color = blue and xcor >= 16 and patch-here = nobody [ ; set available 1] ; [ ; set available 0] ; ifelse color = pink and xcor < 16 and patch-here = nobody [ ; set available 1] ; [ ; set available 0] ; ;end ;
There is only one version of this model, created over 6 years ago by Adeeba Mumtaz.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.