Create n
moving agents
with a set of defined variables.
createTurtles(n, coords, world, heading, breed, color)
# S4 method for numeric,matrix,missing
createTurtles(n, coords, world, heading, breed, color)
# S4 method for numeric,missing,ANY
createTurtles(n, coords, world, heading, breed, color)
Integer.
Matrix (ncol
= 2) with the first column xcor
and the second
column ycor
representing the turtles
initial locations.
nrow(coords)
must be equal to 1 or to n
.
Given coordinates must be inside the world
's extent. If missing,
turtles
are put in the center of the world
.
WorldMatrix
or worldArray
object.
Numeric. Vector of values between 0 and 360. Must be of length 1 or
of length n
. If missing, a random heading
is assigned to
each turtle
.
Character. Vector of breed
names. Must be of length 1 or of length
n
. If missing, breed = "turtle"
for all turtles
.
Character. Vector of color
names. Must be of length n
.
If missing, colors
are assigned using the function rainbow(n)
.
AgentMatrix
object of length n
with data for the
turtles
being: xcor
, ycor
, who
, heading
, prevX
, prevY
,
breed
, and color
.
If coords
is provided, world
must not be provided.
Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
w1 <- createWorld(
minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
data = runif(25)
)
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
plot(w1)
points(t1, col = of(agents = t1, var = "color"), pch = 16)