Cafeteria Model Version 3

Cafeteria Model Version 3 preview image

1 collaborator

Default-person Nida Fatima (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 128 times • Downloaded 5 times • Run 0 times
Download the 'Cafeteria Model Version 3' modelDownload this modelEmbed this model

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

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 set label "take order"]]
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 orange]
  ask patch 24 13 [ set pcolor orange]
  ask patch 24 12 [ set pcolor orange]
  ask patch 24 5 [ set pcolor orange]
  ask patch 24 4 [ set pcolor orange]
  ask patch 24 3 [ set pcolor orange]
  ask patch 24 -14 [ set pcolor orange]
  ask patch 24 -13 [ set pcolor orange]
  ask patch 24 -12 [ set pcolor orange]
  ask patch 24 -5 [ set pcolor orange]
  ask patch 24 -4 [ set pcolor orange]
  ask patch 24 -3 [ set pcolor orange]

  ask patch 13 14 [ set pcolor orange]
  ask patch 13 13 [ set pcolor orange]
  ask patch 13 12 [ set pcolor orange]
  ask patch 13 5 [ set pcolor orange]
  ask patch 13 4 [ set pcolor orange]
  ask patch 13 3 [ set pcolor orange]
  ask patch 13 -14 [ set pcolor orange]
  ask patch 13 -13 [ set pcolor orange]
  ask patch 13 -12 [ set pcolor orange]
  ask patch 13 -5 [ set pcolor orange]
  ask patch 13 -4 [ set pcolor orange]
  ask patch 13 -3 [ set pcolor orange]

ask patch -24 14 [ set pcolor orange]
  ask patch -24 13 [ set pcolor orange]
  ask patch -24 12 [ set pcolor orange]
  ask patch -24 5 [ set pcolor orange]
  ask patch -24 4 [ set pcolor orange]
  ask patch -24 3 [ set pcolor orange]
  ask patch -24 -14 [ set pcolor orange]
  ask patch -24 -13 [ set pcolor orange]
  ask patch -24 -12 [ set pcolor orange]
  ask patch -24 -5 [ set pcolor orange]
  ask patch -24 -4 [ set pcolor orange]
  ask patch -24 -3 [ set pcolor orange]

  ask patch -13 14 [ set pcolor orange]
  ask patch -13 13 [ set pcolor orange]
  ask patch -13 12 [ set pcolor orange]
  ask patch -13 5 [ set pcolor orange]
  ask patch -13 4 [ set pcolor orange]
  ask patch -13 3 [ set pcolor orange]
  ask patch -13 -14 [ set pcolor orange]
  ask patch -13 -13 [ set pcolor orange]
  ask patch -13 -12 [ set pcolor orange]
  ask patch -13 -5 [ set pcolor orange]
  ask patch -13 -4 [ set pcolor orange]
  ask patch -13 -3 [ set pcolor orange]
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
ask servers [
  rt random 10
  fd 1

    if orderitem != 0 and pcolor = orange [set pcolor sky set label "placing order on table"]
;if pcolor = sky [set pcolor orange set label " Removing dish from table"]

  ]
  ask servers [
  rt random 10
  fd 1

if orderitem != 0  and pcolor = sky [set pcolor orange set label " Removing dish from table"]

  ]
  tick

  if ticks >= 1200 [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 about 1 year ago by Nida Fatima.

Attached files

File Type Description Last updated
Cafeteria Model Version 3.png preview Preview for 'Cafeteria Model Version 3' about 1 year ago, by Nida Fatima Download
odd-behavior-space 3.pdf pdf ODD and Behavior Space Experiment about 1 year ago, by Nida Fatima Download

This model does not have any ancestors.

This model does not have any descendants.