Student_Cafeteria_V2_Bahria
Model was written in NetLogo 6.0.3
•
Viewed 85 times
•
Downloaded 9 times
•
Run 0 times
Download this model
•
Embed this model
To embed this model in another Web site, use the following link:
<iframe src="http://modelingcommons.org/browse/one_model/5430?embedded=true" />
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
patches-own [ table-number ;; number (1, 2, or 3) to identify the food sources ] globals[ rtable-one rtable-two ltable-one ltable-two total-customer ] turtles-own [fwd num i head ctimer servtime ] breed [male maless] breed [female femaless] breed [servers servess] to setup clear-all create-female females [ set shape "person" set color red setxy 2 -10 set heading 0 set fwd 1 ] ;;students create-male males [ set shape "person" set color blue set heading 0 setxy -1 -10 set fwd 1 ] ask patches[ creat-tables ] ask turtles[ set num 0 set i 19 set head 0 set heading 0 ] ask patch -5 14 [ set pcolor white ] ask patch -2.5 14 [ set pcolor white ] ask patch 2 14 [ set pcolor white ] reset-ticks end to go check-customer ask turtles with [color = blue][ ask one-of turtles [ ifelse (color = white)[eatattable] [ifelse (color = pink)[ wait-atserving][fd 0.5]] if(pycor = -4 )[ ifelse ( rtable-one != 1)[ move-to patch -10 -3 set color white set pcolor green + 1 set rtable-one rtable-one + 1 set ctimer wait-at-table ] [ if ( ltable-one != 1)[ set ltable-one ltable-one + 1 move-to patch 10 -3 set pcolor red + 4 set color white set ctimer wait-at-table ] ] ] ];;one of turtles ];;color blue ask turtles with [color = red][ ask one-of turtles with [color = red][ if(pycor = 4 )[ ifelse ( ltable-two != 1)[ set ltable-two ltable-two + 1 set color white move-to patch 10 5 set pcolor green set ctimer wait-at-table ] [if (rtable-two != 1)[ set color white move-to patch -10 5 set pcolor red + 2 set rtable-two rtable-two + 1 set ctimer wait-at-table ] ] ] ] if (pcolor = red)[ set color pink ] ask turtles with [color = pink] [ move-to patch 2 12 set servtime perc_boywaiting wait-atserving ] ] ask turtles[ If (color = white)[eatattable] if (color = yellow)[move-to patch 0 -14 ] ] table-zero check-customer tick if ticks >= 19000 [stop] end to check-customer set total-customer females + males if (count turtles with [color = yellow] = total-customer)[ STOP ] end to table-zero ifelse any? turtles with [color = white] [ ][set rtable-two 0 set ltable-two 0 set rtable-one 0 set ltable-one 0] end to creat-tables ;; patch procedure if(pxcor > -9 and pycor > 12 and pxcor < 6 and pycor < 18) [set pcolor red] ;; setup Table one on the right if (distancexy (0.6 * max-pxcor) 4) < 0.6 [ set table-number 3 set pcolor blue set ltable-two 0 ] if (distancexy (0.6 * max-pxcor) -4) < 0.6 [ set table-number 1 set pcolor gray set ltable-one 0 ] if (distancexy (-0.6 * max-pxcor) 4) < 0.6 [ set table-number 7 set pcolor red set rtable-two 0 ] if (distancexy (-0.6 * max-pxcor) -4) < 0.6 [ set table-number 5 set pcolor green set rtable-one 0 ] end to eatattable set ctimer ctimer - 1 ;decrement-timer set label ctimer if ctimer = 0 [ set label "" set pcolor black move-home ] end to wait-atserving set servtime servtime - 1 ;decrement-timer set label "waiting" if servtime = 0 [ set color red set label "order_Received" set heading 180 ] end To move-home fd 6 set color yellow move-to patch 0 -14 end
There is only one version of this model, created over 6 years ago by wasiq khan.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Student_Cafeteria_V2_Bahria.png | preview | Preview for 'Student_Cafeteria_V2_Bahria' | over 6 years ago, by wasiq khan | Download |
This model does not have any ancestors.
This model does not have any descendants.