BUIC Cafeteria Version 3

No preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Default-person Taif Ali (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.2 • Viewed 27 times • Downloaded 0 times • Run 0 times
Download the 'BUIC Cafeteria 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

;Author Name Taif ali
;taifekhann@gamil.com
;version 3




globals [tickCount ]
breed [servers server]
turtles-own [time-notify
 arrival-tick
timetoserve
  itemtoorder

]

to setup
  clear-all


  ask patches [ setup-barcounter]
  ask patches [ setup-tables]
  ask patches [ setup-chairs]


  setupserver
  setup-students

  reset-ticks
end 

to setupserver


  set-default-shape servers "person"

 ; ask n-of 3 (patches with [pcolor = brown]) [sprout-servers 1 [set color blue set size 3 ]]
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 red]
  ask patch 24 13 [ set pcolor red]
  ask patch 24 12 [ set pcolor red]
  ask patch 24 5 [ set pcolor red]
  ask patch 24 4 [ set pcolor red]
  ask patch 24 3 [ set pcolor red]
  ask patch 24 -14 [ set pcolor red]
  ask patch 24 -13 [ set pcolor red]
  ask patch 24 -12 [ set pcolor red]
  ask patch 24 -5 [ set pcolor red]
  ask patch 24 -4 [ set pcolor red]
  ask patch 24 -3 [ set pcolor red]

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

to setup-chairs
  ask patch 26 14 [ set pcolor white]
   ask patch 26 12 [ set pcolor white]
  ask patch 22 14 [ set pcolor white]
   ask patch 22 12 [ set pcolor white]

  ask patch 26 5 [ set pcolor white]
   ask patch 26 3 [ set pcolor white]
  ask patch 22 5 [ set pcolor white]
   ask patch 22 3 [ set pcolor white]

  ask patch 26 -5 [ set pcolor white]
   ask patch 26 -3 [ set pcolor white]
  ask patch 22 -5 [ set pcolor white]
   ask patch 22 -3 [ set pcolor white]

  ask patch 26 -14 [ set pcolor white]
   ask patch 26 -12 [ set pcolor white]
  ask patch 22 -14 [ set pcolor white]
   ask patch 22 -12 [ set pcolor white]

  ask patch 15 14 [ set pcolor white]
   ask patch 15 12 [ set pcolor white]
  ask patch 11 14 [ set pcolor white]
   ask patch 11 12 [ set pcolor white]

  ask patch 15 5 [ set pcolor white]
   ask patch 15 3 [ set pcolor white]
  ask patch 11 5 [ set pcolor white]
   ask patch 11 3 [ set pcolor white]

  ask patch 15 -5 [ set pcolor white]
   ask patch 15 -3 [ set pcolor white]
  ask patch 11 -5 [ set pcolor white]
   ask patch 11 -3 [ set pcolor white]

  ask patch 15 -14 [ set pcolor white]
   ask patch 15 -12 [ set pcolor white]
  ask patch 11 -14 [ set pcolor white]
   ask patch 11 -12 [ set pcolor white]
end 

to setup-students

  reset-ticks
  set-default-shape turtles "person"

  create-turtles totalnoofstudents[
    set color one-of [brown pink]
    set ycor random-ycor

    set arrival-tick ticks

    set time-notify responsetime
  ]

ask n-of ( int (orderplacedbyboys / 100 * count turtles  with [color = brown ])) turtles
  [
movetocounter
  ]
ask n-of ( int (orderplacedbygirls / 100 * count turtles  with [color = pink ])) turtles
  [
movetocounter
  ]
end 

to distinct-student
  if any? other turtles-here [
    fd 2
    distinct-student
  ]
end 

to go
 proceed-turtles

  tick


  if ticks >= 720 [stop]
end 

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



    ifelse pcolor != white
    [continue]
    [stay]
   ; [leave]
   ; if ycor > 25 [ die ]
  ]
end 
 To continue
  lt random 9
  rt random 9
  fd 3
end 

to stay
  set time-notify time-notify - 1
  set label time-notify
  if time-notify = 0
    [
      Continue
      set label ""

    ] if ticks - arrival-tick > 70[ die ]
end 

to reset-arrival
  set time-notify responsetime
end 

to movetocounter
  let targ one-of patches with[pcolor = blue]

  set label "give order"
end 

There is only one version of this model, created 25 days ago by Taif Ali.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.