Student_Cafe V3

Student_Cafe V3 preview image

1 collaborator

Default-person Muhammad Karim (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 142 times • Downloaded 8 times • Run 0 times
Download the 'Student_Cafe V3' 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
  Ma
  Fe
  num
  i
  head
  waiting
  waits
  lab
  x
  y
  a
  b
]

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 label waits
    set heading 0
    set fwd 1
  ]
  ;;students
  create-male males
  [
     set shape "person"
     set label waits
  set color red
    set heading 0
   setxy -1 -10
  set fwd 1

  ]
  create-waiter 1[
     set shape "person service"
  setxy 0 11
    set heading 180
   set color white
  ]
   create-servant 2[
    set shape "person"
  setxy random-xcor random-ycor
set size 2
   set color white
  ]

  ask patches[
  setup-table
    recolor-patch
  ]
  ask  turtles[
  set num 0
    set i 19
set head 0
    set waits 0
    set Fe 0
    set Ma 0
set x 8.37
      set y 7.99999999999997
    set a -8.37
      set b 7.99999999999997
  ]

  reset-ticks
end 

to go

   ask turtles[


   if i = 3
    [
      set i 19
    ]
  ]
ask turtles[
    if Fe >= 8 [stop]
    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

    ]
    ]

    ]
  ask turtles[
   if head >= 8
    [

      ask turtle 9 [


    setxy x y
      set label "Getting Order"
      setxy 0 11
        set label "Giving Order"
 set y y - 3
    ]



    ask turtle 10 [


    setxy a b
      set label "Getting Order"
      setxy 0 11
        set label "Giving Order"
 set b b - 3
    ]


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



;          set waiting random 100
;
;if head >= 8[
;
;    if Fe < 8
;      [
;
;    ask turtle Fe
;     [
;
;
;
;
;
;        while [waiting != waits ]
;        [
;          set waits waits + 1
;              set label waits
;          if waits = waiting
;          [
;           set lab waits
;              set label lab
;              set heading 180
;              set Ma Ma + lab
;              fd 4
;          ]
;        ]
;
;          set waits 0
;
;
;
;
;    ]
;     set Fe Fe + 1
;  ]
;
;
;  ]
end 

to move-turtle


;    if M > 3 and M <= 7[
;    ask turtle M
;
;      [
; if head >= 8[
;
;      if label != "0"[
;          set waiting random 100
;            ]
;       set waits 0
;        while [waiting != waits ]
;        [
;          set waits waits + 1
;              set label waits
;          if waits = waiting
;          [
;            die
;          ]
;        ]
;          set M M + 1
;      ]
;
;    ]
;  ]
end 

to setup-table  ;; patch procedure

    if (distancexy ( 0 * max-pxcor) 12) < 2
  [
   set pcolor Blue
  ]
  ;; 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 Muhammad Karim.

Attached files

File Type Description Last updated
Student_Cafe V3.png preview Preview for 'Student_Cafe V3' almost 6 years ago, by Muhammad Karim Download

This model does not have any ancestors.

This model does not have any descendants.