Bees

Bees preview image

1 collaborator

55 Nathan Holbert (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.4 • Viewed 586 times • Downloaded 33 times • Run 0 times
Download the 'Bees' 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

Unfinished Test

This was a test model I messed around with one afternoon after seeing on frontline that how bees choose a new hive is an emergent phenomenon. The basic premise was that scout bees go out and look check out new hives. When they return, they do a little dance to tell the other bees how great the hive they found is. When other bees also try to report about the hives they saw, it's all about who has the most emphatic dance (they also try to disrupt the dance of one another). I thought it woud be cool to model this, but never quite finished it.

Posted over 11 years ago

Click to Run Model

patches-own [
  home?
  loc
  loc-size
  door-size
]

turtles-own [
  fav-loc
  fav-rating
  found-loc?
  loc-spot
  flash-count
  old-color
]

breed [ bees bee]
breed [ scouts scout ]
breed [ movers mover ]

to setup
  clear-all
  ask patches [
    setup-home
  ]
  ifelse random-loc? = true[
    ask one-of patches with [pcolor = black][
      setup-new-loc 1
    ]
    ask one-of patches with [pcolor = black][
      setup-new-loc 2
    ]
  ] [
    ask patch -10 0 [
      setup-new-loc 1
    ]
    ask patch 10 0 [
      setup-new-loc 2
    ]
  ]
  ask patches [
    setup-loc-props
  ]
  setup-bees
  reset-ticks
end 

to setup-home
  set home? (distancexy 0 0) < 5
  if home? = true [ 
    set pcolor yellow
    ]
end 

to setup-new-loc [n]
  let randx [pxcor] of self
  let randy [pycor] of self
  if n = 1 [
    set loc n
    ask patches in-radius 3 [ set loc n ]
  ]
  if n = 2 [
    set loc n
    ask patches in-radius 3 [ set loc n ]
  ]
end 

to setup-loc-props
  if loc = 1 [
    set pcolor blue
    set loc-size loc1-size
    set door-size loc1-door-size
  ]
  if loc = 2 [
    set pcolor red
    set loc-size loc2-size
    set door-size loc2-door-size
  ]
end 

to setup-bees
  create-bees num-bees [
    set color white
    set size 2
    move-to one-of patches with [home? = true]
    set loc-spot 0
  ]
  ask n-of num-scouts bees [
    set breed scouts
    set color grey
    set found-loc? false
  ]
end 

to go
  ask turtles [
    wiggle
    check-for-move
  ]
  ask bees [
    check-for-dance
  ]
  ask scouts [
    ifelse found-loc? = false
      [ check-loc ]
      [ run-home 
        share-loc ]
  ]
  ask movers [
    move-home
  ]
  tick
end 

to wiggle
  ifelse breed = bees [
    ifelse [pcolor != yellow] of patch-ahead 0.1 [
      rt random 360
    ][
      fd 0.1
      rt random 360
    ]
  ][
    ifelse loc-spot = 0 [
      fd 0.2
      rt random 360
    ] [
      face one-of patches with [loc = [loc-spot] of myself]
      rt random 180
      lt random 180
      fd 0.2
    ]
  ]
end 

to check-loc
  if [pcolor != black and pcolor != yellow] of patch-here[
    set fav-loc [loc] of patch-here
    set color [pcolor] of patch-here - 2
    set fav-rating (loc-size + door-size) / 2
    set flash-count floor fav-rating
    set found-loc? true
    set loc-spot 0
  ]
end 

to run-home
  face one-of patches with [home? = true]
  rt random 180
  lt random 180
  fd 0.1
end 

to share-loc
  if color = green [
    set color old-color
  ]
  if [pcolor = yellow] of patch-here and color != green [
    if flash-count > 0 [
      set old-color color
      set color green
      set flash-count flash-count - 1
    ]
  ]
  if any? other scouts in-radius 1 with [color = green and fav-rating < [fav-rating] of myself][
    let other-scouts any? other scouts in-radius 1 with [color = green and fav-rating < [fav-rating] of myself]
    ask other-scouts [
      set flash-count 0
    ]
  ]
end 

to check-for-dance
  if any? scouts in-radius 1 with [color =  green] [
    let dancer one-of scouts in-radius 1 with [color =  green]
    if random 100 < 20 [
      set breed scouts
      set color grey
      set found-loc? false
      set loc-spot [fav-loc] of dancer
    ]
  ]
end 

to check-for-move
  if count scouts with [fav-loc = [fav-loc] of myself] in-radius 2 > floor count bees * .9 [
    set breed movers
  ]
end 

to move-home
  face one-of patches with [loc = [fav-loc] of myself]
  rt random 180
  lt random 180
  fd 0.1
end 

There is only one version of this model, created over 11 years ago by Nathan Holbert.

Attached files

File Type Description Last updated
Bees.png preview Preview for 'Bees' over 11 years ago, by Nathan Holbert Download

This model does not have any ancestors.

This model does not have any descendants.