Jump to content

Help Please how can i add Tick into these NetLogo Code?

- - - - -

  • Please log in to reply
No replies to this topic

#1
femi

femi

    Newbie

  • Members
  • Pip
  • 4 posts
Please how can i add Tick into these NetLogo Code?


to setup
clear-all
set-default-shape turtles "bug"
;; randomly distribute wood chips
ask patches
[ if random-float 100 < density
[ set pcolor yellow ] ]
;; randomly distribute termites
create-turtles number [
set color white
setxy random-xcor random-ycor
set size 5 ;; easier to see
]
end

to go ;; turtle procedure
search-for-chip
find-new-pile
put-down-chip
end

to search-for-chip ;; turtle procedure -- "picks up chip" by turning orange
ifelse pcolor = yellow
[ set pcolor black
set color orange
fd 20 ]
[ wiggle
search-for-chip ]
end

to find-new-pile ;; turtle procedure -- look for yellow patches
if pcolor != yellow
[ wiggle
find-new-pile ]
end

to put-down-chip ;; turtle procedure -- finds empty spot & drops chip
ifelse pcolor = black
[ set pcolor yellow
set color white
get-away ]
[ rt random 360
fd 1
put-down-chip ]
end

to get-away ;; turtle procedure -- escape from yellow piles
rt random 360
fd 20
if pcolor != black
[ get-away ]
end

to wiggle ; turtle procedure
fd 1
rt random 50
lt random 50
end




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users