Bahria University Cafeteria Model 3
Model was written in NetLogo 6.0.3
•
Viewed 183 times
•
Downloaded 18 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
patches-own [ table-number ;; number (1, 2, or 3) to identify the food sources ] turtles-own [fwd Ma Fe num i head waiting waits lab ] breed [male maless] breed [female femaless] breed [waiter waiters] breed [servant servants] to setup clear-all ask patches [ set pcolor orange ] create-female females [ set shape "person" set color brown setxy 2 -10 set label waits set heading 0 set fwd 1 ] ;;students create-male males [ set shape "person" set label waits set color black set heading 0 setxy -1 -10 set fwd 1 ] create-waiter 1[ set shape "person service" setxy 0 11 set heading 180 set color white ] create-servant 3[ set shape "person" setxy random-xcor random-ycor set size 2 set color white ] ask patches[ setup-table recolor-patch ] ask turtles[ set num 0 set i 19 set head 0 set waits 0 set Fe 0 set Ma 0 ] create-turtles 1 [ set color orange set size 3 setxy -15 -14 ] reset-ticks end to go ask turtles[ if i = 3 [ set i 19 ] ] ask turtles[ if Fe >= 8 [stop] if num < 8[ ask turtle num [ while [fwd < i][ fd 0.1 set fwd fwd + 0.1 ] ;set num num - 1 if num < 4 [ set heading 90] if num > 4 and num < 8 [ set heading -90] ] set num num + 1 set i i - 4 ] if num >= 8 [ if head < 8 [ ask turtle head [ fd 0.67 ] set head head + 1 ] ] ask servant [ rt one-of [-90 0 90] ;; go left, straight, or right forward 1 ; set heading ((random 4) * 90) ; fd 0.1 ] ;----------------------------------------------------------------------------------- set waiting random 100 if head >= 8[ if Fe < 8 [ ask turtle Fe [ while [waiting != waits ] [ set waits waits + 1 set label waits if waits = waiting [ set lab waits set label lab set heading 180 set Ma Ma + lab fd 4 ] ] set waits 0 ] set Fe Fe + 1 ] ] ] end to move-turtle ; if M > 3 and M <= 7[ ; ask turtle M ; ; [ ; if head >= 8[ ; ; if label != "0"[ ; set waiting random 100 ; ] ; set waits 0 ; while [waiting != waits ] ; [ ; set waits waits + 1 ; set label waits ; if waits = waiting ; [ ; die ; ] ; ] ; set M M + 1 ; ] ; ; ] ; ] end to setup-table ;; patch procedure if (distancexy ( 2 * max-pxcor) 14) < 4 [ set pcolor Blue ] ;; setup Table one on the right if (distancexy (0.6 * max-pxcor) 0) < 0.6 [ set table-number 1 set pcolor grey ] if (distancexy (0.6 * max-pxcor) 4) < 0.6 [ set table-number 2 set pcolor grey ] if (distancexy (0.6 * max-pxcor) 8) < 0.6 [ set table-number 3 ] if (distancexy (0.6 * max-pxcor) -4) < 0.6 [ set table-number 4 set pcolor grey ] if (distancexy (-0.6 * max-pxcor) 0) < 0.6 [ set table-number 5 set pcolor grey] if (distancexy (-0.6 * max-pxcor) 4) < 0.6 [ set table-number 6 set pcolor grey] if (distancexy (-0.6 * max-pxcor) 8) < 0.6 [ set table-number 7 set pcolor grey] if (distancexy (-0.6 * max-pxcor) -4) < 0.6 [ set table-number 1 ] end to recolor-patch ;; patch procedure ;; give color to nest and food sources if table-number = 1 [ set pcolor grey ] if table-number = 2 [ set pcolor grey ] if table-number = 3 [ set pcolor grey ] ;; scale color to show chemical concentration end
There is only one version of this model, created over 6 years ago by Sannan Butt.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Bahria University Cafeteria Model 3.png | preview | Preview for 'Bahria University Cafeteria Model 3' | over 6 years ago, by Sannan Butt | Download |
This model does not have any ancestors.
This model does not have any descendants.