Cafeteria Model

Cafeteria Model 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 123 times • Downloaded 5 times • Run 0 times
Download the 'Cafeteria Model' 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

;Author Nida Fatima
; V 1.0
; jaffrinida@yahoo.com
turtles-own [count-down
 birth-tick]

to setup
  clear-all


  setupworld

  reset-ticks
end 

to setupworld
  ask patches [ setup-path ]
  ask patches [ setup-tables]
  ask patches [ setup-chairs]
  setup-students
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-tables
  ask patch 24 14 [ set pcolor black]
  ask patch 24 13 [ set pcolor black]
  ask patch 24 12 [ set pcolor black]
  ask patch 24 5 [ set pcolor black]
  ask patch 24 4 [ set pcolor black]
  ask patch 24 3 [ set pcolor black]
  ask patch 24 -14 [ set pcolor black]
  ask patch 24 -13 [ set pcolor black]
  ask patch 24 -12 [ set pcolor black]
  ask patch 24 -5 [ set pcolor black]
  ask patch 24 -4 [ set pcolor black]
  ask patch 24 -3 [ set pcolor black]

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

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

  ask patch -13 14 [ set pcolor black]
  ask patch -13 13 [ set pcolor black]
  ask patch -13 12 [ set pcolor black]
  ask patch -13 5 [ set pcolor black]
  ask patch -13 4 [ set pcolor black]
  ask patch -13 3 [ set pcolor black]
  ask patch -13 -14 [ set pcolor black]
  ask patch -13 -13 [ set pcolor black]
  ask patch -13 -12 [ set pcolor black]
  ask patch -13 -5 [ set pcolor black]
  ask patch -13 -4 [ set pcolor black]
  ask patch -13 -3 [ set pcolor black]
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
  ]
end 

to separate-student
  if any? other turtles-here [
    fd 1
    separate-student
  ]
end 

to go
  move-turtles

  tick


  if ticks >= 720 [stop]
end 

to move-turtles
  ask turtles with [color = pink ]
  [



    ifelse pcolor != green
    [continue]
    [stay]
   ; [leave]
   ; if ycor > 25 [ die ]
  ]
  ask turtles with [color = blue ]
  [


    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 

There is only one version of this model, created 3 months ago by Nida Fatima.

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.