simulation of bahriabv3

simulation of bahriabv3 preview image

1 collaborator

Default-person Ayesha Anwar (Author)

Tags

cosmose 

Tagged by Ayesha Anwar almost 6 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 176 times • Downloaded 15 times • Run 0 times
Download the 'simulation of bahriabv3' 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

turtles-own [counting
order_serving_time
  order_food ]
globals [

   student_patches
  counter_patches
  table_patches1
  table_patches2
  table_patches3
  table_patches4
  ]
breed [waiters waiter]

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

to setup-cafeteria
  make-tables
  make-students
  make-waiters
end 

to make-tables
  ask patches [ set pcolor white ]
  set counter_patches patches with [ pxcor >= 0 and pycor > 14  ]
  ask counter_patches [
    set pcolor black
  ]

  set table_patches1 patches with [ pxcor = -8  and pycor = 10 ]
  ask table_patches1 [ set pcolor blue + 3
  ask neighbors4 [ set pcolor orange ]
  ]

  set table_patches2 patches with [ pxcor = -8  and pycor = -13 ]
  ask table_patches2 [ set pcolor blue + 3
  ask neighbors4 [ set pcolor orange ]
  ]

  set table_patches3 patches with [ pxcor = -8  and pycor = -4 ]
  ask table_patches3 [ set pcolor blue + 3
  ask neighbors4 [ set pcolor orange ]
  ]

  set table_patches4 patches with [ pxcor = 9    and pycor = 2 ]
  ask table_patches4 [ set pcolor blue + 3
  ask neighbors4 [ set pcolor red ]
  ]

  set table_patches4 patches with [ pxcor = 9    and pycor = -8 ]
  ask table_patches4 [ set pcolor blue + 3
  ask neighbors4 [ set pcolor red ]
  ]
end 

to make-students
  set-default-shape turtles "person"
  create-ordered-turtles no_of_students [
    set color one-of [green yellow]
    set xcor -3 + who
    set ycor -16
    set size 0.8
   ;;move-to-empty-one-of student_patches
  ]
  ask n-of ( int (percentage_girl_order / 100 * count turtles  with [color = yellow ])) turtles
  [
move-to-food
  ]
ask n-of ( int (percentage_boy_order / 100 * count turtles  with [color = green ])) turtles
  [
move-to-food
  ]
     ;;move-to-empty-one-of student_patches
end 

to move-same-students
    set size 1
    set heading 0
    setxy (10 + random -22) min-pycor
end 

to make-waiters
  create-waiters number-of-waiters
  [
    set shape "person"
    set color violet
    set size 1
    set xcor 14 + who
    set ycor 14

  ]
end 

to go
  if ticks >= 500 [stop]
  ask turtles
  [
    move-students
    move-waiters
  ]
  tick
end 

to move-students
  ask turtles with [color = green ]
  [
    ifelse pcolor != orange
    [move]
    [stay]

  ]
  ask turtles with [color = yellow ]
  [


    ifelse pcolor != red
    [move]
    [stay]

  ]
   ask turtles with [color = violet ]
  [


    ifelse pcolor != black
    [move]
    [stay]

  ]
end 

 To move
 lt random 10
  rt random 10
  fd 1.5
end 

to stay
  set counting counting - 1
  if counting = 0
    [
      stay
      reset-counting
    ]
end 

to reset-counting
  set counting waiting_time
end 

to move-waiters

    ask waiters [
  rt random 10
  fd 1.5

    if order_food = 0 and pcolor = blue + 3 [set pcolor brown ]
]
end 

to move-to-food
  let targ one-of patches with[pcolor = black]
  set order_serving_time serving_time
  set order_food random 3
end 

There is only one version of this model, created almost 6 years ago by Ayesha Anwar.

Attached files

File Type Description Last updated
simulation of bahriabv3.png preview Preview for 'simulation of bahriabv3' almost 6 years ago, by Ayesha Anwar Download

This model does not have any ancestors.

This model does not have any descendants.