samedi 19 décembre 2015

How To Move Turtles To Highest Random Neighbour Patches

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




Aucun commentaire:

Enregistrer un commentaire