### downhill
downhill4

#### downhill patch-variable
downhill4 patch-variable

Moves the turtle to the neighboring patch with the lowest value for patch-variable. If no neighboring patch has a smaller value than the current patch, the turtle stays put. If there are multiple patches with the same lowest value, the turtle picks one randomly. Non-numeric values are ignored.

downhill considers the eight neighboring patches; downhill4 only considers the four neighbors.

Equivalent to the following code (assumes variable values are numeric):

    move-to patch-here  ;; go to patch center
    let p min-one-of neighbors [patch-variable]  ;; or neighbors4
    if [patch-variable] of p < patch-variable [
      face p
      move-to p
    ]

Note that the turtle always ends up on a patch center and has a heading that is a multiple of 45 (downhill) or 90 (downhill4).

See also uphill, uphill4.

Take me to the full NetLogo Dictionary