Student_Cafeteria

Student_Cafeteria preview image

1 collaborator

Default-person Ahsan Asim (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.3 • Viewed 101 times • Downloaded 6 times • Run 0 times
Download the 'Student_Cafeteria' 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

patches-own [
  table-number   ;; number (1, 2, or 3) to identify the food sources
]

turtles-own [fwd
  num
  i
  head
]

breed [male maless]
breed [female femaless]
breed [waiter waiters]
breed [servant servants]

to setup
clear-all
  create-female females
  [
     set shape "person"
    set color blue
    setxy 2  -10
    set heading 0
    set fwd 1
  ]
  ;;students
  create-male males
  [
     set shape "person"
  set color red
    set heading 0
   setxy -1 -10
  set fwd 1

  ]
  create-waiter 1[
     set shape "person service"
  setxy -1.5 11
    set heading 180
   set color white
  ]
   create-servant 3[
    set shape "face happy"
  setxy random-xcor random-ycor

   set color white
  ]
  create-turtles 1 [
    set shape "circle"
  setxy -2 10
    set size 0.4
    set color grey
  ]
  create-turtles 1 [
    set shape "circle"
  setxy -1 10
    set size 0.4
    set color grey
  ]
  create-turtles 1 [
    set shape "circle"
  setxy -1.5 10
    set size 0.4
    set color grey
  ]
  ask patches[
  setup-table
    recolor-patch
  ]
  ask  turtles[
  set num 0
    set i 19
set head 0
  ]
end 

to go

   ask turtles[

   if i = 3
    [
      set i 19
    ]
  ]
ask turtles[
    if num < 8[
    ask turtle num [

    while [fwd < i][


        fd 0.1
      set fwd fwd + 0.1


    ]
       ;set num num - 1

if num < 4 [ set heading 90]
        if num > 4 and num < 8 [ set heading -90]
    ]
     set num num + 1
  set i i - 4
  ]
    if num >= 8 [
      if head < 8 [
      ask turtle head [
      fd 0.67

      ]

      set head head + 1

    ]
    ]
  ]
end 

to servent
  ask servant [
    rt one-of [-90 0 90]                ;; go left, straight, or right
    forward 1
;    set heading ((random 4) * 90)
;    fd 0.1
  ]
end 

to setup-table  ;; patch procedure

    if (distancexy (-0.1 * max-pxcor) 12) < 2.4
  [
   set pcolor orange
  ]
  ;; setup Table one on the right
  if (distancexy (0.6 * max-pxcor) 0) < 0.6
  [ set table-number 1
   set pcolor yellow
  ]
  if (distancexy (0.6 * max-pxcor) 4) < 0.6
  [ set table-number 2
   set pcolor yellow
  ]
   if (distancexy (0.6 * max-pxcor) 8) < 0.6
  [ set table-number 3 ]
    if (distancexy (0.6 * max-pxcor) -4) < 0.6
  [ set table-number 4
   set pcolor yellow
  ]

  if (distancexy (-0.6 * max-pxcor) 0) < 0.6
  [ set table-number 5
   set pcolor yellow]
  if (distancexy (-0.6 * max-pxcor) 4) < 0.6
  [ set table-number 6
   set pcolor yellow]
  if (distancexy (-0.6 * max-pxcor) 8) < 0.6
  [ set table-number 7
   set pcolor yellow]

  if (distancexy (-0.6 * max-pxcor) -4) < 0.6
  [ set table-number 1 ]
end 

to recolor-patch  ;; patch procedure
  ;; give color to nest and food sources

      if table-number  = 1 [ set pcolor yellow ]
      if table-number  = 2 [ set pcolor yellow  ]
      if table-number  = 3 [ set pcolor yellow ]
    ;; scale color to show chemical concentration
end 

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

Attached files

File Type Description Last updated
Student_Cafeteria.png preview Preview for 'Student_Cafeteria' almost 6 years ago, by Ahsan Asim Download

This model does not have any ancestors.

This model does not have any descendants.