Bahria-Cafeteria-Simulation-Model-V2

Bahria-Cafeteria-Simulation-Model-V2 preview image

1 collaborator

Default-person Yasir Siddique (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 151 times • Downloaded 17 times • Run 0 times
Download the 'Bahria-Cafeteria-Simulation-Model-V2' 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

breed [males male]
breed [females female]
breed [servers server]

males-own [cafe-time status]
females-own [cafe-time status]

globals [counter]

to setup
  clear-all
  setup-cafeteria
  reset-ticks
end 

to setup-cafeteria
  make-counter
  make-tables
  make-students
  make-servers
  set counter 0
end 

to make-counter
  ask patch (0) (max-pycor) [
    ask patches with [ distance myself < 6 ] [
      set pcolor yellow
    ]
  ]
end 

to make-tables
  ask patch (-0.6 * max-pxcor) 5 [
    ask patches with [ distance myself < 2.5 ] [
      set pcolor blue
    ]
  ]
  ask patch (0.6 * max-pxcor) 5 [
    ask patches with [ distance myself < 2.5 ] [
      set pcolor cyan
    ]
  ]
  ask patch (-0.6 * max-pxcor) -5 [
    ask patches with [ distance myself < 2.5 ] [
      set pcolor red
    ]
  ]
  ask patch (0.6 * max-pxcor) -5 [
    ask patches with [ distance myself < 2.5 ] [
      set pcolor green
    ]
  ]
end 

to make-students
  create-ordered-males male-students
  [
    set shape "person"
    set color white
    move-same-students
  ]
  create-ordered-females female-students
  [
    set shape "person"
    set color pink
    move-same-students
  ]
end 

to move-same-students
    set size 1.5
    set heading 0
    setxy (10 + random -22) min-pycor
    set cafe-time average-waiting-time
    set status 0
end 

to make-servers
  create-servers number-of-servers
  [
    set shape "person"
    set color black
    set size 1.5
    setxy (1 + random 5) (max-pycor - 2)
  ]
end 

to go
  ask males
  [
    if pycor != 12 [ move-students ]
  ]
  ask females
  [
    if pycor != 12 [ move-students ]
  ]
  tick
end 

to move-students
  if (ticks mod 60 = 0) [ set cafe-time (cafe-time - 1) ]
  if (cafe-time = 0) [ die ]

  if counter = 0
  [
    if(status = 0)
    [
      move-to patch -12 -5
      set status 1
      set counter counter + 1
    ]
  ]
  if counter = 1
  [
    if(status = 0)
    [
      move-to patch -15 -6
      set status 1
      set counter counter + 1
    ]
  ]
  if counter = 2
  [
    if(status = 0)
    [
      move-to patch 14 -3
      set status 1
      set counter counter + 1
    ]
  ]
  if counter = 3
  [
    if(status = 0)
    [
      move-to patch 14 -7
      set status 1
      set counter counter + 1
    ]
  ]
  if (status = 0)
  [
    fd random 2
  ]

  set label cafe-time
end 

There is only one version of this model, created over 6 years ago by Yasir Siddique.

Attached files

File Type Description Last updated
Bahria-Cafeteria-Simulation-Model-V2.png preview Preview for 'Bahria-Cafeteria-Simulation-Model-V2' over 6 years ago, by Yasir Siddique Download
ODD-Bahria-Cafeteria-V2.docx word ODD-Bahria-Cafeteria-V2 over 6 years ago, by Yasir Siddique Download

This model does not have any ancestors.

This model does not have any descendants.