Bahria University Cafeteria Model 2

Bahria University Cafeteria Model 2 preview image

1 collaborator

Img20171125151127 Sannan Butt (Author)

Tags

cosmos 

Tagged by Sannan Butt over 7 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.3 • Viewed 286 times • Downloaded 20 times • Run 0 times
Download the 'Bahria University Cafeteria Model 2' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

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 pink
    setxy 2  -10
     set label waits
    set heading 0
    set fwd 1
  ]
  ;;students
  create-male males
  [
     set shape "person"
     set label waits
  set color brown
    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) < 2
  [
   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 7 years ago by Sannan Butt.

Attached files

File Type Description Last updated
Bahria University Cafeteria Model 2.png preview Preview for 'Bahria University Cafeteria Model 2' over 7 years ago, by Sannan Butt Download

This model does not have any ancestors.

This model does not have any descendants.