moveTo: Move to

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Move the turtles to the agents' locations.

Usage

1
2
3
4
moveTo(turtles, agents)

## S4 method for signature 'agentMatrix,matrix'
moveTo(turtles, agents)

Arguments

turtles

AgentMatrix object representing the moving agents.

agents

Matrix (ncol = 2) with the first column pxcor and the second column pycor representing the patches coordinates, or

AgentMatrix object representing the moving agents.

Details

The number of agents must be equal to 1 or to length turtles.

The turtle's headings are not affected with this function.

If a turtle is moving to a patch location, it will be located at the patch center.

Value

AgentMatrix representing the turtles with updated coordinates and updated data for their previous coordinates prevX and prevY.

Author(s)

Sarah Bauduin

References

Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

See Also

https://ccl.northwestern.edu/netlogo/docs/dictionary.html#move-to

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9,
                          data = runif(100))
t1 <- createTurtles(n = 5, coords = randomXYcor(w1, n = 5))
plot(w1)
points(t1, col = "black", pch = 16)

t1 <- moveTo(turtles = t1, agents = turtle(t1, who = 0))
points(t1, col = "red", pch = 16)

t1 <- moveTo(turtles = t1, agents = patch(w1, 9, 9))
points(t1, col = "blue", pch = 16)

NetLogoR documentation built on July 10, 2021, 5:06 p.m.