Netlogo entry-level programming help
Extend the NetLogo model Termites to include two types of wood chips which the termites gather independently into two separate piles. I have most of the code but I
cannot figure out how to get the termites to separate the chips into two different piles. They just seem to combine them. I would like you to work off of my code and
not rewrite the entire code.
set-default-shape turtles “bug”
;; randomly distribute wood chips
ask patches [
if random-float 100 < density [ ifelse random 2 < 1 [ set pcolor yellow ] [ set pcolor green ] ] ] ;; randomly distribute termites create-turtles number [ set color white setxy random-xcor random-ycor set size 5 ;; easier to see ] endto go ;; turtle procedure search-for-chip find-new-pile put-down-chip endto search-for-chip ;; turtle procedure -- "picks up chip" by turning orange ifelse pcolor = black [ wiggle search-for-chip ] [ ifelse pcolor = green [ set pcolor black set color cyan ] [ set pcolor black set color orange ]fd 20 ] endto find-new-pile ;; turtle procedure -- look for yellow patches ifelse (color = orange and pcolor = yellow) or (color = cyan and pcolor = green) [ ;; this page blank on purpose ] [ wiggle find-new-pile ] endto put-down-chip ;; turtle procedure -- finds empty spot & drops chip ifelse pcolor = black [ifelse color = cyan [ set pcolor green ] [ set pcolor yellow ]set color white get-away] [ rt random 360 fd 1 put-down-chip ] endto get-away ;; turtle procedure -- escape from yellow piles rt random 360 fd 20 if pcolor != black [ get-away ] endto wiggle ; turtle procedure fd 1 rt random 50 lt random 50 end