turtles to their neighboring patch with the lowest value.
1 2 3 4 5 6 7
Character. If the
Integer: 4 or 8. Represents the number of neighbor
Logical to determine if the
If no neighboring
patch has a smaller value than the
patch where the
turtle is currently located on, the
turtle stays on this
patch. It still
moves to the
patch center if it was not already on it.
If there are multiple neighboring
patches with the same lowest value,
turtle chooses one
turtle is located on a
patch on the edge
torus = FALSE, it has fewer
patches as options to move than
torus = TRUE, the
turtle can move on the other side of the
move downhill and its choice of neighboring
patches is always equals to
AgentMatrix representing the
turtles with updated
coordinates and updated data for their
heading values and
Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
1 2 3 4 5 6 7 8
w1 <- createWorld(minPxcor = 1, maxPxcor = 10, minPycor = 1, maxPycor = 10, data = runif(100)) t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10)) plot(w1) points(t1, col = of(agents = t1, var = "color"), pch = 16) t1 <- downhill(world = w1, turtles = t1, nNeighbors = 8) points(t1, col = of(agents = t1, var = "color"), pch = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.