Bar Moth

No preview image

1 collaborator

Default-person John Shull (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0 • Viewed 431 times • Downloaded 43 times • Run 0 times
Download the 'Bar Moth' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model was designed to demonstrate customer flow within a bar. The default floorplan is based upon a college bar located within walking distance to Old Dominion University called Mojo Bones. Mojo Bones has been in the area since 2005. As a BBQ resturant during the day, Mojo Bones has an average lunch crowd, but during the night Mojo Bones gets incredibly crowded. This model represents the crowd on a typical Thursday Night.

The partial version of the model loads the default template of Mojo Bones and only allows the user to place the dance floor and the different tables.

HOW IT WORKS

The model is based off four simple rules that have precedence over each other. Rule 1. If you have to use the restroom, go to the restroom. Rule 2. If your drink is almost empty, go to the bar and get another drink. Rule 3. If you're single, then you mingle. If you're not single, you find the closest open barstool and take a seat. Rule 4. Once you have had to much to drink: You dance.

All agents use a set of lists to determine what area of the bar to go to for service. They will go to the initial service spot as long as they are receiving 'good' service. If at one point they do not receive good service, they will go to the next area of the bar that to them has a 'high rank'.

In order for a single agent to find a 'crush', he/she will only choose another agent that is better looking then themselves, but not too much 'better' looking. This represents the general concept that people date within their 'class'. However, as the agent drinks more, he/she will gain more confidence, resulting in the capability to date someone out of their class.

All single ladies will dance once they have hit a user threshold. Only the men who have found a date, and who have hit the user threshold, will dance.

HOW TO USE IT

Default Mode

Follow the listed sequence to use this model.

The interface is setup into three areas.
Area one: Left of the Environment includes all user functions related to setting the model up. Area two: The Model Environment (center) Area three: Right of the Environment, includes information and plots relevant to the model.

For use in Default Mode just hit the 'Default' button.
Upon the file loading, it will confirm that the floor plan loaded, and then it will confirm if the dance floor loaded. Hit okay. If you receive an error message at this step please make sure that the text file listed within the error message is saved in the same directory as the model file. *There are seven user defined sliders. These are the default settings for the current configuration. Listed below explains what each one does.

User Sliders

'Skills' With a range from 1-10. This will effect the 'rate' and 'quality' at which a bar staff member can make a drink. The higher the skill, the higher the rate and quality.
'Number_staff' Select the quantity of bar staff you would like to have. 'Patrons' Select the total amount of customers you would like to have at the bar. 'PercentageFemale' Is in terms of %, meaning that if you have '100 patrons' and you select 50 here, you will have 50 males and 50 females.
'DrinksTillDance' Sets the threshold at which point a customer has had X amount of drinks to have built up the urge to dance. 'MaxDrinksMale' Sets the drink limit for customers who are male. Once they have reached this limit, the customer will be asked to leave and another customer will be allowed in. 'MaxDrinksFemale' Sets the drink limit for customers who are female. Once they have reached this limit, the customer will be asked to leave and another customer will be allowed in. 'Looks_Vision' Sets the vision at which each agent can detect a member of the opposite sex that they find appealing.

Go Step

At this point you can run the model by hitting the 'Go' button.
*Notice that there are still two buttons below the 'Go' button, these buttons allow you to gain more information visually. The first button, 'Show Dense Crowd' will use a diffusion to allow you to see where the most customers are at in a relative area to the bar. The second button 'See Best Looking' will mark the highest value 'looks' of both male and female by placing a color coded circle around them. If you get an error with this button, it is because the shape used was a custom shape and needs to be imported into the model.

Custom User Mode

Step One

The setup process goes from top down. Start with Area one, left of the environment, at the top two sliders. 'NumFourTop_Tables' A slider that allows you to set the number of tables that can sit four people. 'NumEightTop_Tables' A slider that allows you to set the number of tables that can sit eight people. Once you have set these sliders to your desired choice hit the button "1.) User Defined" This button will load the default floor plan file.

Step Two

Next hit '2.) Setup Tables' This will load the initialized user defined quantity of tables.
*Notice the tables off to the side in the green area.

Step Three

Hit the button that says "3.) Draw Dance Floor" *Notice that the button stays down.
This button will allow you to draw the dance floor within the environment. You can draw the dance floor any where there is a black colored patch within the environment. Use the mouse to draw the area. If at any point you make a mistake, you can hit the "Clear Dance Floor" button. This will erase all previous work assocaited with the dance floor. Once you are finished drawing the dance floor, make sure to unclick the "Dance floor" button.

Step Four

Hit the button that says "4) Move Tables" *Notice that the button stays down. This button will allow you to 'grab' any one of the yellow or orange tables that were placed off to the side. Use the mouse to select and place each table, place the desired tables within the area that there is a black colored patch. You do not have to use all of the tables, just make sure that the tables you are not using are not within the bar environment (keep the unused tables outside the white area where the patches are green) Once you have placed the desired tables within the environment, make sure to unclick the "Move tables" button.

Step Five

There are seven user defined sliders. They were mentioned in the default setting. Make sure to adjust them to your specifications.
After setting the desired user settings up, hit the button "5.) Place People" at which point the model will be filled with bar staff, customers, and bar stools.

Go Step

At this point you can run the model by hitting the 'Go' button.

Area Three: The Right Side of the Model

You will see various monitors and a plot. They are tracking information that might be relavent to the user. The model's intentions are to visually monitor the area's of the bar. Common area's to monitor involve the number of people at the bar counter, number of people designated to be dancing, number of people sitting down, and number of people in the bathroom area. Starting from the Top: 'Total Single Customers' : Total customers who have their variable single = 1 'Single Females/males': Total customers, by gender, who have their variable single = 1 'Total Customers that are single without crush': total customers who are single but have not found a 'date' 'Total Customers that are single with crush': total customers who are single that have found a 'date' 'Single Males/Females with a crush': Customers broken down by gender, who are single, that have found a 'date' 'Total People linked to best looking female/male': Is first a measure of how many people have found the best looking male/female as an interest of a 'crush' plus any customers who are crushing on the individual who has a crush on the best looking male/female. 'Bar,Bathroom, and Dance Plot': A visual plot of how many people are at each destination. Directly below the plot are monitors associated with the plot- the numeric amounts associated with the plot.
Utilization monitors: Taking the number of customers using/at the designated item/area, and dividing by the total amount of available item/area. **'AvgDrinkPoints per BC': is a measure of the average value of each patch of the bar. This is measured based off its current 'Drink Points' value. Drink points are assigned from the bartenders. When a staff member makes a drink, it is given a point value. This point value is a combination of the staff's skill and associated randomness with each different level of skill. The staff are to place 'drinkpoints' at any patch of the bar that has a customer near it, and if the bar is below a value of 15. So there is a chance that the value of a bar patch can be higher than 25. 'Total Drink Value on Bar Counter': a measure of the total 'drinkpoints' at the bar. 'Mean # drinks each customer has had': current average of all customers and how many drinks they have had. 'Avg. Drink Point Value Staff is making': the mean amount of 'drinkpoints' the staff is making, this is directly related to their skill level.

THINGS TO NOTICE

Notice with the default setups that you see a mass of people form at one region of the bar, once the model gets up and fully running this mass will shift from the bar to the bathroom- as expected. These wild swings are associated with the numeric values that are assigned to the agents. Another predetermined function is the association of as more people get their drink counts up, they will begin to dance. The system visually represents how the bar, Mojo Bones, has customer fluctuations throughout its floor plan- how around

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

The full version of the model will have the capability to allow the user full control in the design concept of the model including: drawing the floor plan, placing the facilities (bathrooms), placing the service areas (bar), establishing a dance floor, and then placing different size tables.

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [ males BP_male]
breed [ females BP_female]
breed [ BAR bar_staff ]
breed [ Tablefour four_top ]
breed [ TableEight eight_top  ]
breed [ barstools barstool]
breed [ customers customer]



globals
[
 MensRoom
 WomensRoom
 DanceFloorCor
 CurrentBarValue
 AVGBarValue
 Crowd
 BestGuy
 BestGirl
 NetworkB
 NetworkG
 AVGDrinkCount
]

patches-own
[
 obstacle
 openspace
 BarCounter
 DrinkPoints
 Swarm
]

customers-own
[
  power
  path
  BarCoordinates
  powerrank
  placeinlist
  gender
  bladderrate
  drinkcount
  stuck
  drinkconsume
  drinkhand
  bathroom
  rate
  dance
  danceCor
  single
  seat
  looks
  crush
  numfollowingme
 
]


Bar-own
[
  DrinkMakingRate  
  CurrentDrinks
]

to Floor_Plan
  clear-all
  
  set-patch-size 15
  resize-world 0 60 0 60
  ask patches [set pcolor black]
 
  ifelse( file-exists? "bar_floor_plan.txt")
  [
    file-open "bar_floor_plan.txt"
    while [not file-at-end?]
    [
      let next-x file-read
      let next-y file-read
      let next-color file-read
      ask patch next-x next-y [set pcolor next-color]
    ]
    user-message "Bar Floor Plan Loaded Correctly!"
    file-close
  ]
  [ user-message "**ERROR** Cannot find the file: bar_floor_plan.txt in the current directory"]

  set WomensRoom patch 48 44
  set MensRoom patch 52 44
  ask patches with [pcolor = 9.9]
  [
    set obstacle 1
  ]
  ask patches with [pcolor = 6]  
  [
    set obstacle 1
  ]
  ask patches with [pcolor = 35]
  [
    set Barcounter 1
    set drinkpoints 30
  ]
  set avgbarvalue 0 
  set AVGDrinkCount 0
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to default
  Floor_Plan
  ifelse( file-exists? "dance_floor.txt")
  [
    file-open "dance_floor.txt"
    while [not file-at-end?]
    [
      let next-x file-read
      let next-y file-read
      let next-color file-read
      ask patch next-x next-y [set pcolor next-color]
    ]
    user-message "Dance Floor Loaded Correctly!"
    file-close
  ]
  [ user-message "**ERROR** Cannot find the file: dance_floor.txt in the current directory"]
  setupTablesDefault
  Setup-people
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to SetupTablesDefault
  set-default-shape Tablefour "square"
  set-default-shape barstools "dot"
  create-Tablefour 10 
  ask Tablefour [
    set size 2.5
    set color 45
    setxy 45 10
  ]
  set-default-shape TableEight "square"
  create-TableEight 4 
  ask TableEight [
    set size 4
    set color 26
    setxy 48 10
  ]
 ask four_top 1 [
   setxy 17 37]
 ask four_top 2 [
   setxy 17 42
 ]
 ask four_top 3 [
   setxy 17 47
 ]
 ask four_top 0 [
   setxy 11 47
 ]
 ask four_top 4 [
   setxy 11 42
 ]
 ask four_top 5 [
   setxy 11 37
 ]
 ask four_top 6 [
   setxy 27 37
 ]
 ask four_top 7 [
   setxy 27 31
 ]
 ask four_top 8 [
   setxy 27 26
 ]
 ask four_top 9[
   setxy 27 21
 ]
 ask eight_top 10 [
   setxy 38 15
 ]
 ask eight_top 11 [
   setxy 38 21
 ]
 ask eight_top 12 [
   setxy 38 27
 ]
 ask eight_top 13 [
   setxy 38 33
 ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to SetupTables
  set-default-shape Tablefour "square"
  set-default-shape barstools "dot"
  create-Tablefour Num_Four_Top_Tables 
  ask Tablefour [
    set size 2.5
    set color 45
    setxy 45 10
  ]
  set-default-shape TableEight "square"
  create-TableEight Num_Eight_Top_Tables 
  ask TableEight [
    set size 4
    set color 26
    setxy 48 10
  ]
  if (Num_Four_Top_Tables > 1)
  [
    let i 0
    let y4t 10
    while [i < Num_Four_Top_Tables]
    [
      ask four_top i [
        setxy 45 y4t]
      set i i + 1
      set y4t y4t + 2.5
    ]
  ]
  if (Num_Eight_Top_Tables > 1)
  [
    let i count Tablefour
    let y4t 10
    while [i < Num_Four_Top_Tables + Num_Eight_Top_Tables]
    [
      ask eight_top i [
        setxy 48 y4t]
      set i i + 1
      set y4t y4t + 3.5
    ]
  ]
  let tag1 0
  let tag2 0
  
  ask four_top (Num_Four_Top_Tables - 1) [                       
    set tag1 ycor + 2]
  ask eight_top (Num_Four_Top_Tables + Num_Eight_Top_Tables - 1) [
    set tag2 ycor + 2]
  
  ask patch (46) (tag1) [
    set plabel-color black
    set plabel "4-Tops"
  ]
  
  ask patch (48) (tag2) [
    set plabel-color black
    set plabel "8-Tops"
  ]
  ask patch 49 40 [
    set plabel-color black
    set plabel "TABLES CHOICES"
  ] 
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to MoveTables
  
  if mouse-down? [
    let pickup4 min-one-of Tablefour [distancexy mouse-xcor mouse-ycor]
    let pickup8 min-one-of TableEight [distancexy mouse-xcor mouse-ycor]
    let pick4 [distancexy mouse-xcor mouse-ycor] of pickup4
    let pick8 [distancexy mouse-xcor mouse-ycor] of pickup8
    while [mouse-down?] [
      ifelse (pick4 < pick8)
          [
            ask pickup4 [ 
              setxy (round mouse-xcor) (round mouse-ycor)
            ]
          ][ask pickup8 [setxy (round mouse-xcor) (round mouse-ycor)]]
      display
    ]
  ]
end 
    
;;///////////////////////////////////////////////////////////////////////////////////////////////

to Erasedance
    ask patches with [pcolor = 114]
    [
      set pcolor black
    ]     
    set dancefloorcor nobody
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Dancefloor
  if (mouse-down?)
    [
      let TX round mouse-xcor
      let TY round mouse-ycor
      ask patch TX TY [
        if (pcolor = black)
        [
          set pcolor 114]
        ]
    ]  
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Setup-people  
  reset-ticks
  GenerateBarStools
  set dancefloorcor one-of patches with [pcolor = 114]
    ask patches with [pcolor = black]
  [
    if (not any? turtles-here)
    [set openspace 1
    ]
  ]
  set-default-shape customers "person"
  set-default-shape BAR "person service"
  set-default-shape TableEight "square"
  
  ask n-of Patrons (patches with [pcolor = black and pycor < 25 ])
  [
    if not any? turtles-here
    [
      sprout-customers 1 [
        set path (list (patch (6 + random 36) 52) (patch (7 + random 35) 52) (patch (8 + random 34) 52) (patch 40 52) (patch (10 + random 32) 52))
        set power (list (1 + random 20) (1 + random 20) (1 + random 20) (1 + random 20) (1 + random 20) )
        set powerrank (list 0 0 0 0 0)
        calculateRanking
        
        set heading random 360
        set color blue
        set size 2
        set drinkcount 0
        set gender 1
        set bathroom MensRoom
        set drinkconsume .99
        set bladderrate .4
        set rate 3.1 + random-float .5
        set dance 0
        set dancecor dancefloorcor
        set single 1
        set looks (30 + random 71)
        set crush nobody
      ]
    ]
  ]
  ask n-of (round (( PercentageFemale / 100) * Patrons)) customers [
    set  gender 0
    set color pink
    set rate 2.1 + random-float .5
    set bathroom WomensRoom
    set dance 1
  ]
ask n-of (0.57 * patrons) customers [
  set single 0
]
  ask n-of Number_staff (patches with [pcolor = 6])
    [
      sprout-BAR 1 [set heading random 360
    set color white
    set size 2
    set drinkmakingrate (skills * (1 + random-float 1))
    set CurrentDrinks 0
      ]
    ]  
  set bestguy nobody
  set bestgirl nobody
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to GenerateBarStools

 ask Tablefour [
   if ((xcor < 42) and (xcor > 5 ) and (ycor > 10) and (ycor < 60))
   [
     let i 0
     ask patch-here[
       set pcolor 9.9 
       set obstacle 1 ]
     ask neighbors4[
       set pcolor 9.9
       set obstacle 1]
     while [i < 4 ]
     [
      hatch-barstools 1 [
        set size 2
        set color 8
        set heading (i * 90)
        forward 1.75
      ]    
       set i i + 1
     ]
   ]
 ]
 ask Tableeight [
   if ((xcor < 42) and (xcor > 5 ) and (ycor > 10) and (ycor < 60))
     [   
       let i 0
       ask neighbors [
         set pcolor 9.9
         set obstacle 1]
       while [i < 4 ]
         [
           hatch-barstools 1 [
             set size 2
             set color 8
             set heading (i * 90)
             forward 2
             right 90
             forward 0.5
             left 180 
             hatch-barstools 1 [
               forward 1
             ]
           ]
         set i i + 1
         ]
     ]
 ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to GO
  DoCalculations
  ask customers [
    routine
    set numfollowingme count customers with [crush = myself]
  ]
  
  ask Bar [
    staff-routine
  ]

  if (any? patches with [swarm > 1])
    [ 
      diffuse swarm 0.75
      RecolorCrowd
    ]
  tick
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to DoCalculations
  if (bestguy != nobody)
  [
    set networkB (sum [numfollowingme] of customers with [crush = bestguy]) + (count customers with [crush = bestguy])
    set networkG (sum [numfollowingme] of customers with [crush = bestgirl]) + (count customers with [crush = bestgirl])
  ]
  set CurrentBarValue sum [drinkpoints] of patches with [pcolor = 35]
  set AvgBarValue mean [drinkpoints] of patches with [pcolor = 35]
  set Crowd max-one-of patches [count customers in-radius 10]
  set AvgDrinkCount mean [drinkcount] of customers
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to MarkBestLooking
  set BestGuy max-one-of (customers with [gender = 1]) [looks]
  ask bestguy [
    set shape "Markedmale"
    set size 2
  ]
  set Bestgirl max-one-of (customers with [gender = 0]) [looks]
  ask bestgirl [
    set shape "markedfemale"
    set size 2
  ]
end 
;;///////////////////////////////////////////////////////////////////////////////////////////////

to Routine
  Intoxicated
  ifelse (bladderrate > 20)
    [
      face bathroom
      checkobstacle
      BathRoomFunction
    ]
    [
      ifelse (drinkhand < 1.5)
      [ 
        usememory
        face BarCoordinates
        checkobstacle
        BarCounterFunction (BarCoordinates)
      ]
      [
        ifelse (single = 0)
        [
          FindBarstool
        ]
        [
          ifelse (single = 1) and (drinkcount < Drinks_till_dance)
          [
            finddate
            ConsumeDrink
            checkobstacle
          ]
          [
            if (gender = 1) and (crush != nobody)
            [
              set dance 1
            ]
            
            ifelse (dance = 1) and (drinkcount >= Drinks_till_Dance)
            [
              ifelse any? patches with [pcolor = 114]
                [
                  face dancecor
                  checkobstacle
                  danceaway
                  ConsumeDrink
                ]
                [set dance  0]
                ]
                [ConsumeDrink
                checkobstacle
                ]
            ]
          ]
        ]
      ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Intoxicated
  if (gender = 1) and (drinkcount > max_drinks_male)
  [
    hatch 1 [
      set crush nobody
      set drinkcount 0
      set rate 3.1 + random-float .5
      set dance 0
      set dancecor dancefloorcor
      set single random 2
      set looks (30 + random 71)
      set bladderrate .4
      set numfollowingme 0
      set shape "person"
    ]
      
    ask self [die] 
  ]
  if (gender = 0) and (drinkcount > max_drinks_male)
  [
    hatch 1 [
      set crush nobody
      set drinkcount 0
      set rate 2.1 + random-float .5
      set dance 1
      set dancecor dancefloorcor
      set single random 2
      set looks (30 + random 71)
      set bladderrate .4
      set numfollowingme 0
      set shape "person"
      ]
    ask self [die]
    ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Checkobstacle 
    ifelse ([obstacle] of patch-ahead 1 != 1) and (not any? customers-on patch-ahead 1)
    [
        walkabout
        set stuck 0 
    ]
    [ 
      ifelse (stuck > 2)
      [
        while [[obstacle] of patch-ahead 1 = 1]
        [
          right random-float 90
        ]
        walkabout
        while [[obstacle] of patch-ahead 1 = 1]
        [
          left random-float 180
          set stuck 0
        ]
        walkabout
      ]
      [
        left random-float 90 
        set stuck stuck + 1
        checkobstacle
      ]
    ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Danceaway
  if (patch-here = dancecor)
  [
    right random-float 360
    checkobstacle
    forward random-float 1
    back random-float 1
    left random-float 360
    checkobstacle
    forward random-float 1
    back random-float 1
    if (gender = 0)
    [
      set color scale-color pink drinkhand 20 0 
    ]
    if (gender = 1)
    [
      set color scale-color blue drinkhand 20 0
    ]
    set dancecor one-of patches with [pcolor = 114]
  ]
end 

;;////////////////////////////////////////////////////////////////////////////////////////////////

to FindBarstool
  ifelse (any? barstools-here) 
  [
    ConsumeDrink
  ][
  checkobstacle
  if(any? barstools in-cone 4 160)
  [
    set Seat min-one-of barstools [distance myself]
    face Seat
    ConsumeDrink
    checkobstacle
  ]
  ]  
end 

;;////////////////////////////////////////////////////////////////////////////////////////////////

to FindDate
 
  
  if (gender = 0)
  [
    if (crush = nobody) and (any? customers in-radius Look_Vision with [gender = 1])
    [
      let potentiallist customers in-radius Look_Vision with [gender = 1]
      let tempA max-one-of potentiallist [looks]
      let theirlooks 0
      ask tempA [
        set theirlooks looks
      ]
      if (theirlooks >= looks ); and (theirlooks <= (looks + drinkcount * 3 ))
      [
        set crush tempA 
      ]
    ]
  ]
  
  if (gender = 1)
  [
    if (crush = nobody) and (any? customers in-radius Look_Vision with [gender = 0])
    [
      let potentiallist customers in-radius Look_Vision with [gender = 0]
      let tempA max-one-of potentiallist [looks]
      let theirlooks 0
      ask tempA [
        set theirlooks looks
      ]
      if (theirlooks > looks); and (theirlooks < (looks + drinkcount * 3))
      [
        set crush tempA  
      ]
    ]
  ]
  if (crush != nobody)
  [
    face crush
    if (any? customers in-radius 5 = crush)
    [
      right random-float 90
    ] 
  ]
end 

;;////////////////////////////////////////////////////////////////////////////////////////////////

to Walkabout
forward random-float 1
end 

;;////////////////////////////////////////////////////////////////////////////////////////////////

to ConsumeDrink
  let waste drinkhand
  set drinkhand (drinkhand * drinkconsume) 
  set waste ((waste - drinkhand) / rate)
  set bladderrate bladderrate + waste  
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to WhereIsCrowd
  ask crowd [
    set swarm 10]
  diffuse swarm 0.75
  RecolorCrowd
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to RecolorCrowd
  ask patches with [swarm > 0]
   [
     if (openspace = 1)
     [
       set pcolor scale-color red swarm 0 10
     ]
   ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to BathRoomFunction
  if (patch-here = bathroom) 
  [
    set bladderrate (bladderrate / (1 + random 20))
  ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to BarCounterFunction [Coordinates]
  let BC 0

  if (patch-here = Coordinates) 
  [

    ask patch-here
      [
        ifelse (drinkpoints > 25)
        [
          
          set drinkpoints 0
          set BC 25
        ][
       
        set BC drinkpoints
        set drinkpoints 0
        ]
      ]
    set drinkhand drinkhand + BC
    set drinkcount drinkcount + (BC / 25)
    ifelse (BC < 25)
      [
        let pvalue (random 21) + 5
        let pathvalue patch (10 + random 10) (52) 
        let ranvalue (random-float 1) * pvalue
        let PowNew rebuildlist(power)
        let PatNew rebuildlist(path)
        let RanNew rebuildlist(powerrank)
        set PowNew lput pvalue PowNew
        set PatNew lput pathvalue PatNew
        set RanNew lput ranvalue RanNew       
        set power PowNew
        set path PatNew
        set powerrank RanNew
        calculateranking
      ][ set power lput [BC] of patch-here power
      set power but-first power
      set path lput patch-here path
      set path but-first path
      calculateRanking
      ]
     
  ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to CalculateRanking
  let n 0
  let large patch-here
  let x1 0
  let y1 0
  let mydist 0
  let distrank (list 0 0 0 0 0)
  while [n < 5]
  [
    set large item n path
    ask large [ 
      set x1 pxcor
      set y1 pycor
    ]
    set mydist distancexy x1 y1  
    set mydist (1.00 / (mydist + .1))
    set distrank lput mydist distrank
    set distrank but-first distrank
    set n n + 1
  ]
  set powerrank (map + (distrank)(power))
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to-report Rebuildlist [finlist]
  let T1 sublist finlist 0 placeinlist
  let T2 sublist finlist (placeinlist + 1) 5  
  let R 5 - (length T1) - 1
  let i 0
  while [i < R]
  [
    set T1 lput (item i T2) T1 
    set i i + 1
  ]    
  report T1
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to UseMemory
  let n 0
  let current 0
  let large 0
  let pos1 0
  while [n < 5]
  [
    set large item n powerrank
    if ( large > current)
    [
      set pos1 n
      set current large
    ]
    set n n + 1
  ]
  ifelse (current > 0)
  [ 
    set BarCoordinates item pos1 path
    set placeinlist pos1
  ][checkobstacle]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Staff-routine
  ifelse (currentdrinks < 5)
  [
    set color blue
    makedrinks
  ][
    set color white
    placedrinks
  ]
end 

;;///////////////////////////////////////////////////////////////////////////////////////////////

to Makedrinks
  if (drinkmakingrate > 1)
  [
    ifelse (drinkmakingrate > 2)
    [
      ifelse (drinkmakingrate > 4)
      [
        ifelse (drinkmakingrate > 6)
        [
          ifelse (drinkmakingrate > 8)
          [
            ifelse (drinkmakingrate > 10)
            [
              ifelse (drinkmakingrate > 12)
              [
                ifelse (drinkmakingrate > 14)
                [
                  ifelse (drinkmakingrate > 16)
                  [
                    ifelse (drinkmakingrate > 18)
                    [
                      set currentdrinks currentdrinks + (40 + random 11)
                    ][set currentdrinks currentdrinks + (30 + random 11)]
                  ][set currentdrinks currentdrinks + (25 + random 6)]
                ][set currentdrinks currentdrinks + (20 + random 6)]
              ][set currentdrinks currentdrinks + (15 + random 6)]
            ][set currentdrinks currentdrinks + (10 + random 6)]
          ][set currentdrinks currentdrinks + (6 + random 5)]
        ][set currentdrinks currentdrinks + (4 + random 3)]
      ][set currentdrinks currentdrinks + (1 + random 4)]
    ][set currentdrinks currentdrinks + (1 + random 2)]
  ]
end 

;;////////////////////////////////////////////////////////////////////////////////////////////////

to Placedrinks
  let DrinkPlace nobody
  let oldp patch-here
  ifelse ([pcolor] of patch-ahead 1 = 6) and (not any? turtles-on patch-ahead 1)
    [
      forward 1
      if(any? patches in-cone 3 160 with [pcolor = 35])
      [
        let Pdrinks currentdrinks
        ask patches in-cone 3 160
          [
            if (barcounter = 1)
            [
              set DrinkPlace min-one-of patches [distance myself]
            ]
          ] 
        ask DrinkPlace [
          if (any? customers in-radius 5) and (drinkpoints < 50)
            [          
              set drinkpoints drinkpoints + Pdrinks
              set Pdrinks 0
            ]
        ]
        set currentdrinks Pdrinks
      ]
      left random-float 360
    ]
    [ 
      ifelse ([pcolor] of patch-ahead 1 = 9.9)
      [
        right random-float 180
      ][
      ]
    ]
  let newp patch-here
  if (oldp = newp)
    [
      let space1 patch-here
      ask neighbors with [pcolor = 6][
        set space1 min-one-of patches [distance myself]
      ]
      face space1
      forward 1
    ]
end 

There is only one version of this model, created almost 11 years ago by John Shull.

Attached files

File Type Description Last updated
Bar_floor_plan.txt data Text File for coordinates related to the 'Default' settings almost 11 years ago, by John Shull Download
dance_floor.txt data Text file for coordinates related to the 'Default' settings almost 11 years ago, by John Shull Download

This model does not have any ancestors.

This model does not have any descendants.