Bahria Cafe V1

Bahria Cafe V1 preview image

1 collaborator

Default-person sumbal khan (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.1 • Viewed 186 times • Downloaded 18 times • Run 0 times
Download the 'Bahria Cafe V1' 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 [persons person]
breed [waiters waiter]
persons-own[ time_to_leave]
patches-own[student-on-table]

globals [
  available
  tablem-x tablem-y
  tablef-x tablef-y
]

to setup
  clear-all
  open-door
  set-tables
  set-chairs
  student-come
  set available 0
  reset-ticks
end 

to open-door
  ask patches with [ pxcor = 16 and pycor = 0]
  [
    set pcolor brown
  ]
end 

to set-tables

  let table 1
  set tablem-x 8 + min-pxcor
  set tablem-y 7
  set tablef-x 24 + min-pxcor
  set tablef-y 7
  while [table < tables ]
  [
  ask patch tablem-x tablem-y [

      set pcolor brown
      set table table + 1
      set tablem-y tablem-y + 10
  ]


  ask patch tablef-x tablef-y [

      set pcolor brown
      set table table + 1
      set tablef-y tablef-y + 10
  ]
  ]
end 

to set-chairs

    ask patch 5 28[ set pcolor orange ]
    ask patch 5 26[ set pcolor orange ]
    ask patch 5 18[ set pcolor orange ]
    ask patch 5 16[ set pcolor orange ]
    ask patch 5 8[ set pcolor orange ]
    ask patch 5 6[ set pcolor orange ]
    ask patch 11 28[ set pcolor orange ]
    ask patch 11 26[ set pcolor orange ]
    ask patch 11 18[ set pcolor orange ]
    ask patch 11 16[ set pcolor orange ]
    ask patch 11 8[ set pcolor orange ]
    ask patch 11 6[ set pcolor orange ]
    ask patch 21 28[ set pcolor orange ]
    ask patch 21 26[ set pcolor orange ]
    ask patch 21 18[ set pcolor orange ]
    ask patch 21 16[ set pcolor orange ]
    ask patch 21 8[ set pcolor orange ]
    ask patch 21 6[ set pcolor orange ]
    ask patch 27 28[ set pcolor orange ]
    ask patch 27 26[ set pcolor orange ]
    ask patch 27 18[ set pcolor orange ]
    ask patch 27 16[ set pcolor orange ]
    ask patch 27 8[ set pcolor orange ]
    ask patch 27 6[ set pcolor orange ]
end 

to student-come
 create-persons initial-students
  [
    choose-sex                   ;; become a man or a woman
    set size 1.5
    setxy 16 0.5
    set shape "person"
    set time_to_leave -1
  ]
end 

to choose-sex  ;; turtle procedure
  set color one-of [pink blue]
end 

to go
   if not any? persons [
    stop
  ]
  ask persons[ ifelse time_to_leave = -1 [
    wiggle
    direct-way
  ]
    [
      set time_to_leave time_to_leave - 1
    if time_to_leave = 0 [
      wiggle
        die
      ]
      ]


  ]
  if count persons with [ycor > 0]  < initial-students
  [
  create-persons 1
  [
    choose-sex                   ;; become a man or a woman
    set size 1.5
    setxy 16 0.5
    set shape "person"
    set time_to_leave -1
  ]
    ]

  tick
end 

to wiggle
  if pcolor != white and pcolor != brown [
  rt random-float 30
  lt random-float 30
  forward 1
  ]
  if pcolor = brown [
    fd 3
  ]
  if pcolor = orange [
    set pcolor white
   fd 0
  set time_to_leave random Avg-waiting-time
  ]
  if pcolor = white and time_to_leave = 0 [
    set pcolor orange
  ]
end 

to direct-way
  if color = blue and xcor >= 16
  [
    rt 180
  ]
   if color = pink and xcor < 16
  [
    lt 180
  ]
end 

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

Attached files

File Type Description Last updated
Bahria Cafe V1.png preview Preview for 'Bahria Cafe V1' over 6 years ago, by sumbal khan Download

This model does not have any ancestors.

This model does not have any descendants.