Ant Pheremone investigation

Ant Pheremone investigation preview image

1 collaborator

Default-person Nye Rhys Potter (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 425 times • Downloaded 49 times • Run 0 times
Download the 'Ant Pheremone investigation' 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 [sugarpad-number
  sugarpad?]

turtles-own [pheremone 
  leader] 

to setup
  clear-all
  setup-patches
  set-default-shape turtles "bug"
  setup-turtles
  reset-ticks
end 

to setup-patches
  ask patches [ set pcolor white 
    setup-sugarpad ]
end 

to setup-sugarpad  
  if sugarpad? and (distancexy (0.5 * max-pxcor) 0) < 5
  [set sugarpad-number 1]
  if sugarpad-number > 0
  [ set pcolor brown ]
end 

to setup-turtles
  crt 5
  [ set size 2        
    set color red  ] 
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to count-ant1
  show [list xcor ycor] of turtle 0
end 

to count-ant2
  show [list xcor ycor] of turtle 1
end 

to count-ant3
  show [list xcor ycor] of turtle 2
end 

to count-ant4
  show [list xcor ycor] of turtle 3
end 

to count-ant5
  show [list xcor ycor] of turtle 4
end 

;;;;;;;;;;;;;;;;;;;;;;;

to go
  if ticks >= 18000 [ stop ]
  move-turtles
  leave-pheremone 
  pheremone-wear-off
  tick
end 

to move-turtles
  ask turtles 
 [ if pcolor != brown and pcolor != yellow and pcolor != 42
   [right random 360
    forward 3]]
 ask turtles
 [if pcolor = yellow 
   [right random 360 forward 5]]
 leave-strong-pheremone-trail
 follow-strong-pheremone-trail
 measure-dispersion-of-turtles
 finish-programme
end 

to leave-pheremone ;;may need to change value
  ask turtles 
  [if pcolor = white and pcolor != 42
  [set pcolor 46]]
end 

to leave-strong-pheremone-trail
 ask turtles
 [if pcolor = brown and color = blue [repeat 1000000 [downhill sugarpad-number]]]
 ask turtles
 [if pcolor = brown and color != blue [set color blue set heading one-of [0 90 180 270] 
 pd repeat 100 [forward 1 if pcolor != brown [set pcolor 42]]]]
end 

to follow-strong-pheremone-trail
  ask turtles
  [if pcolor = 42 and patch-ahead 1 = white or patch-ahead 1 = yellow [set heading heading + 90 ]
  if patch-ahead 1 = 42 [forward 1]]
  ask turtles
  [if pcolor = 42 and patch-ahead 1 = brown [forward 1]]
  ask turtles
  [if pcolor = 42 and patch-ahead 2 = brown [forward 2]]
  ask turtles
  [if pcolor = 42 and patch-ahead 3 = brown [forward 3]]
  ask turtles
  [if pcolor = 42 and patch-ahead 4 = brown [forward 4]]
  ask turtles
  [if pcolor = 42 and patch-ahead 5 = brown [forward 5]]
  ask turtles
  [if pcolor = 42 and patch-ahead 6 = brown [forward 6]]
  ask turtles
  [if pcolor = 42 and patch-ahead 7 = brown [forward 7]]
  ask turtles
  [if pcolor = 42 and patch-ahead 8 = brown [forward 8]]
  ask turtles
  [if pcolor = 42 and patch-ahead 9 = brown [forward 9]]
  ask turtles
  [if pcolor = 42 and patch-ahead 10 = brown [forward 10]]
  ask turtles
  [if pcolor = 42 and patch-ahead 11 = brown [forward 11]]
  ask turtles
  [if pcolor = 42 and patch-ahead 12 = brown [forward 12]]
  ask turtles
  [if pcolor = 42 and patch-ahead 13 = brown [forward 13]]
  ask turtles
  [if pcolor = 42 and patch-ahead 14 = brown [forward 14]]
  ask turtles
  [if pcolor = 42 and patch-ahead 15 = brown [forward 15]]
  ask turtles
  [if pcolor = 42 and patch-ahead 16 = brown [forward 16]]
  ask turtles
  [if pcolor = 42 and patch-ahead 17 = brown [forward 17]]
  ask turtles
  [if pcolor = 42 and patch-ahead 18 = brown [forward 18]]
  ask turtles
  [if pcolor = 42 and patch-ahead 19 = brown [forward 19]]
  ask turtles
  [if pcolor = 42 and patch-ahead 20 = brown [forward 20]]
  ask turtles
  [if pcolor = 42 and patch-ahead 21 = brown [forward 21]]
  ask turtles
  [if pcolor = 42 and patch-ahead 22 = brown [forward 22]]
  ask turtles
  [if pcolor = 42 and patch-ahead 23 = brown [forward 23]]
  ask turtles
  [if pcolor = 42 and patch-ahead 24 = brown [forward 24]]
  ask turtles
  [if pcolor = 42 and patch-ahead 25 = brown [forward 25]]
  ask turtles
  [if pcolor = 42 and patch-ahead 26 = brown [forward 26]]
  ask turtles
  [if pcolor = 42 and patch-ahead 27 = brown [forward 27]]
  ask turtles
  [if pcolor = 42 and patch-ahead 28 = brown [forward 28]]
  ask turtles
  [if pcolor = 42 and patch-ahead 29 = brown [forward 29]]
  ask turtles
  [if pcolor = 42 and patch-ahead 30 = brown [forward 30]]
  ask turtles
  [if pcolor = 42 and patch-ahead 31 = brown [forward 31]]
  ask turtles
  [if pcolor = 42 and patch-ahead 32 = brown [forward 32]]
  ask turtles
  [if pcolor = 42 and patch-ahead 33 = brown [forward 33]]
  ask turtles
  [if pcolor = 42 and patch-ahead 34 = brown [forward 34]]
  ask turtles
  [if pcolor = 42 and patch-ahead 35 = brown [forward 35]]
  ask turtles
  [if pcolor = 42 and patch-ahead 36 = brown [forward 36]]
  ask turtles
  [if pcolor = 42 and patch-ahead 37 = brown [forward 37]]
  ask turtles
  [if pcolor = 42 and patch-ahead 38 = brown [forward 38]]
  ask turtles
  [if pcolor = 42 and patch-ahead 39 = brown [forward 39]]
  ask turtles
  [if pcolor = 42 and patch-ahead 40 = brown [forward 40]]
  ask turtles
  [if pcolor = 42 and patch-ahead 41 = brown [forward 41]]
  ask turtles
  [if pcolor = 42 and patch-ahead 42 = brown [forward 42]]
  ask turtles
  [if pcolor = 42 and patch-ahead 43 = brown [forward 43]]
  ask turtles
  [if pcolor = 42 and patch-ahead 44 = brown [forward 44]]
  ask turtles
  [if pcolor = 42 and patch-ahead 45 = brown [forward 45]]
  ask turtles
  [if pcolor = 42 and patch-ahead 46 = brown [forward 46]]
  ask turtles
  [if pcolor = 42 and patch-ahead 47 = brown [forward 47]]
  ask turtles
  [if pcolor = 42 and patch-ahead 48 = brown [forward 48]]
  ask turtles
  [if pcolor = 42 and patch-ahead 49 = brown [forward 49]]
  ask turtles
  [if pcolor = 42 and patch-ahead 50 = brown [forward 50]]
  ask turtles
  [if pcolor = 42 and patch-ahead 51 = brown [forward 51]]
  ask turtles
  [if pcolor = 42 and patch-ahead 52 = brown [forward 52]]
  ask turtles
  [if pcolor = 42 and patch-ahead 53 = brown [forward 53]]
  ask turtles
  [if pcolor = 42 and patch-ahead 54 = brown [forward 54]]
  ask turtles
  [if pcolor = 42 and patch-ahead 55 = brown [forward 55]]
  ask turtles
  [if pcolor = 42 and patch-ahead 56 = brown [forward 56]]
  ask turtles
  [if pcolor = 42 and patch-ahead 57 = brown [forward 57]]
  ask turtles
  [if pcolor = 42 and patch-ahead 58 = brown [forward 58]]
  ask turtles
  [if pcolor = 42 and patch-ahead 59 = brown [forward 59]]
  ask turtles
  [if pcolor = 42 and patch-ahead 60 = brown [forward 60]]
  ask turtles
  [if pcolor = 42 and patch-ahead 61 = brown [forward 61]]
  ask turtles
  [if pcolor = 42 and patch-ahead 62 = brown [forward 62]]
  ask turtles
  [if pcolor = 42 and patch-ahead 63 = brown [forward 63]]
end 

to pheremone-wear-off
  ask patches
  [if pcolor != white and pcolor != brown and pcolor != 42
  and random 1000 < 1 [set pcolor 47 ]
  ]
end 

to finish-programme
  if all? turtles [pcolor = brown or pcolor = 42]
  [stop] 
end 

to measure-dispersion-of-turtles ;entropy 
  ask turtle 0 [show distance turtle 1]
  ask turtle 0 [show distance turtle 2]
  ask turtle 0 [show distance turtle 3]
  ask turtle 0 [show distance turtle 4]
  ask turtle 1 [show distance turtle 2]
  ask turtle 1 [show distance turtle 3]
  ask turtle 1 [show distance turtle 4]
  ask turtle 2 [show distance turtle 3]
  ask turtle 2 [show distance turtle 4]
  ask turtle 3 [show distance turtle 4]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;By Nye Rhys Potter

There are 7 versions of this model.

Uploaded by When Description Download
Nye Rhys Potter over 9 years ago errors fixing Download this version
Nye Rhys Potter over 9 years ago Now added strong pheremones! Download this version
Nye Rhys Potter over 9 years ago more updates Download this version
Nye Rhys Potter over 9 years ago Added an observer that will show the coordinates of the ants Download this version
Nye Rhys Potter over 9 years ago still fixing issues dosn't yet work as intended Download this version
Nye Rhys Potter over 9 years ago Most updated version of my project about ants Download this version
Nye Rhys Potter over 9 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Ant Pheremone investigation.png preview Preview for 'Ant Pheremone investigation' over 9 years ago, by Nye Rhys Potter Download

This model does not have any ancestors.

This model does not have any descendants.