bees0.3

No preview image

1 collaborator

Default-person Howard Noble (Author)

Tags

(This model has yet to be categorized with any tags)
Child of model bees-0.1
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.2 • Viewed 232 times • Downloaded 20 times • Run 0 times
Download the 'bees0.3' 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

breed [ bees bee ]
breed [ flowers flower ]
breed [ hives hive ]
breed [ apples apple ]
flowers-own [ age fertilisation-count fl-nectar? ]
bees-own [ nectar direction target wiggle-time dance-time ] 
hives-own [ nectar-count ]

to setup
  ca
  create-bees initial-bees [
    set color yellow
    set direction "search"
    set target nobody
    set wiggle-time 0
    set size 2
    set shape "bug"
    ;;move-to one-of patches
  ]
  ask patches with 
  [ pycor <= 1 and pycor >= -1 and pxcor <= 1 and pxcor >= -1 ] 
    [ set pcolor blue ]
  let a ( count patches with [ pcolor != blue ] ) / 10
  ask n-of a patches with [ pcolor != blue ] [
    sprout-flowers 1 [
      set color one-of [ red green blue ]
      set shape "flower"
      set size 2
      set fl-nectar? true
      ]
    ]
  ask patch 0 0 [ 
    set pcolor white
    sprout-hives 1 [
      set shape "square 2"
      set color [ 20 20 20 100 ]
      set size 3
    ]
  ]
  reset-ticks
end 

to go
  ask bees [
    bees-movement ]
  ask flowers with [ fertilisation-count > 20 and fertilisation-count < 30 ] [
    hatch-apples 1 [
      create-link-with min-one-of flowers [ distance myself ]
      set heading random 360
      fd random-float 1
      set size 0.1
      set color 12 + random 5
      set shape "circle" ] ]
  ask flowers with [ fertilisation-count >= 40 ] [
    set fl-nectar? false ]
  ask apples with [ size <= 0.5 ] [
    set size size + 0.1 ] 
  tick
end 

to-report count-apples
  report count apples with [ size >= .5 ]
end 

to bees-movement
  if direction = "search" and target = nobody [
    set target one-of flowers ]
  
  if direction = "search" and target != nobody [
    ;; output-print "hurrah!"
    face target 
    fd 1 
    rt 20 - random 40 
  ]
  
  if one-of turtles-here = target and direction = "search" [
    set direction "wiggle time"
    set wiggle-time 5 ]

  if direction = "wiggle time" [
    set heading heading - random 30 
    set wiggle-time wiggle-time  - 1
    let a min-one-of flowers [ distance myself ]
    if [ fl-nectar? = true ] of a [ 
      ask a [ set nectar nectar + 1 ]
      ask min-one-of flowers [ distance myself ] [ 
        set fertilisation-count fertilisation-count + 1 ] ] ]
  
  if direction = "wiggle time" and wiggle-time <= 0 [ 
    set direction "search"
    set target nobody ] 

  if nectar >= 15 [ 
    set direction "hive" 
    set wiggle-time 0
    set target one-of hives ]

  if direction = "hive" [
    face target 
    fd 1 
    rt 10 - random 20
    if distance target <= 2 [ move-to target ]
  ]
  
  if one-of turtles-here = target and direction = "hive" [
    ask one-of hives [ set nectar-count nectar-count + 5 ]
    set nectar 0
    set direction "hive dance" 
    set dance-time 5 ]
  
  if direction = "hive dance" [
    set dance-time dance-time - 1
    rt 10
    if dance-time <= 0 [ 
      set direction "search" 
      set target nobody ] ]
end 

There are 5 versions of this model.

Uploaded by When Description Download
Howard Noble over 5 years ago fruit added Download this version
Howard Noble over 5 years ago n Download this version
Howard Noble over 5 years ago latest Download this version
Howard Noble over 5 years ago test Download this version
Howard Noble over 5 years ago world size change Download this version

Attached files

No files

Parent: bees-0.1

This model does not have any descendants.

Graph of models related to 'bees0.3'