how to randomly select a neighbor patch that has a higher elevation in netlogo

后端 未结 2 1816
抹茶落季
抹茶落季 2020-12-21 11:38

how to randomly select among all the neighbour patches that are higher instead of the highest neighbour patch? I was thinking to remove (if elevation >= [elevation] of max-

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-21 12:30

    ; The butterfly move procedure in turtle context
    to move ; a turtle procedure
      if elevation >= [elevation] of max-one-of neighbors [elevation] [stop]
      ; Decide whether to move uphill deterministically with probability q
      ifelse random-float 1 < q
       [ uphill elevation ] ; move uphill
       [ move-to one-of neighbors ] ; otherwise move randomly
       set patches-visited patches-visited + 1
    end
    

提交回复
热议问题