Wednesday 15 August 2012

netlogo - Trying to get a turtle breed to avoid a specific colour of patch -



netlogo - Trying to get a turtle breed to avoid a specific colour of patch -

;num-holes global variable. i'm trying them avoid black patches(holes in floor)

if any? patches in-radius num-holes with[pcolor = black] [ set heading (towards min-one-of num-holes[distance myself]) + 180 - random 10 + random 10 ]

i'm trying zombies seek , avoid black patches know netlogo won't take global 'num-holes' how can see , avoid patches ? here wider scope of code incase makes problem clearer.

go inquire zombies [ ;set heading (heading + 45 - (random 90)) allow closest-player min-one-of players[distance myself] set heading towards closest-player ;wait 1 forwards 1 if pcolor = black [death] if pcolor = black [death] ;num-holes global variable. i'm trying them avoid black patches(holes in floor) if any? patches in-radius num-holes with[pcolor = black] [ set heading (towards min-one-of zombies[distance myself]) + 180 - random 10 + random 10 ] ] end

please , give thanks :)

if any? patches in-radius 5 with[pcolor = black] [ stuff]

netlogo

No comments:

Post a Comment