I'm trying to get the turtles to randomly select among all the neighbour patches that are higher. My code gets the turtle to move to the highest patch but I want it to do this randomly.
my code:
to move
if elevation >= [elevation] of max-one-of neighbors[elevation]
[stop]
ifelse random-float 1 < q
[ uphill elevation ]
[ move-to one-of neighbors]
set patches-visited patches-visited + 1
end
in one line
move-to one-of neighbors with [elevation > [elevation] of myself]]
in your code it would like this
to move
if elevation < [elevation] of max-one-of neighbors[elevation]
[
move-to one-of neighbors with [elevation > [elevation] of myself]]
set patches-visited patches-visited + 1
]
end