public abstract class AbstractTurtle
Modifiers | Name | Description |
---|---|---|
boolean |
hiddenQ |
Type | Name and description |
---|---|
void |
addToFixedLeaves(Turtle t) |
void |
addToFreeLeaves(Turtle o) |
AgentSet |
allLinks() {@inheritDoc} |
AgentSet |
allMyInLinks() {@inheritDoc} |
AgentSet |
allMyLinks() {@inheritDoc} |
AgentSet |
allMyOutLinks() {@inheritDoc} |
boolean |
allQ(Collection a, Closure closure) Queries if all agents in a collection are true for a boolean closure. |
void |
ask(AgentSet a, Closure askBlock) Executes a set of commands for an agentset in random order. |
void |
ask(Collection c, Closure askBlock) Executes a set of commands for a collection of agents. |
void |
ask(Turtle t, Closure askBlock) Executes a set of commands for a turtle. |
void |
ask(Patch p, Closure askBlock) Executes a set of commands for a patch. |
void |
ask(Link l, Closure askBlock) Executes a set of commands for a link. |
void |
askCollection(Collection l, Closure cl) |
void |
askTurtle(Closure cl) @exclude |
void |
back(Number num) Steps turtle backwards by a distance. |
void |
bk(Number num) Steps turtle backwards by a distance. |
boolean |
canMoveQ(Number nDist) Queries if turtle can move a distance. |
int |
compareTo(Turtle t) |
Link |
createLinkFrom(Turtle t) Makes a directed link from a turtle to the caller. |
Link |
createLinkFrom(Turtle t, Closure closure) Makes a directed link from a turtle to the caller then executes a set of commands on the created link. |
Link |
createLinkTo(Turtle t) Makes a directed link from the caller to a turtle. |
Link |
createLinkTo(Turtle t, Closure closure) Makes a directed link from the caller to a turtle then executes a set of commands on the created link. |
Link |
createLinkWith(Turtle t) Makes a undirected link between the caller and a turtle. |
Link |
createLinkWith(Turtle t, Closure closure) Makes an undirected link between the caller and a turtle then executes a set of commands on the created link. |
AgentSet |
createLinksFrom(Collection a) Makes directed links from a collection of agents to the caller. |
AgentSet |
createLinksFrom(Collection a, Closure closure) Makes directed links from a collection of turtles to the caller then executes a set of commands on the created links. |
AgentSet |
createLinksTo(Collection a) Makes directed links from the caller to a collection of agents. |
AgentSet |
createLinksTo(Collection a, Closure closure) Makes directed links from the caller to a collection of agents then executes a set of commands on the created links. |
AgentSet |
createLinksWith(Collection a) Makes undirected links between the caller and a collection of agents. |
AgentSet |
createLinksWith(Collection a, Closure closure) Makes undirected links between the caller and a collection of agents then executes a set of commands on the created links. |
void |
die() Removes the turtle. |
double |
distance(Turtle t) Returns the distance from the caller to a turtle. |
double |
distance(Patch p) Returns the distance from the caller to a patch. |
double |
distancexy(Number nX, Number nY) Returns the distance from the caller to a point. |
double |
dx() Returns the turtle's x increment for one step. |
double |
dy() Returns the turtle's y increment for one step. |
void |
face(Turtle t) Faces the caller towards a turtle. |
void |
face(Patch p) Faces the caller towards a patch. |
void |
facexy(Number nX, Number nY) Faces the caller towards a point. |
void |
fd(Number num) Steps turtle forward by a distance. |
void |
fileShow(Object value) Prints value with agent identifier to current file with a newline. |
boolean |
fixedLeavesContains(Turtle t) |
void |
forward(Number num) Steps turtle forward by a distance. |
boolean |
freeLeavesContains(Object o) |
double |
getColor() Returns the color of a turtle. |
double |
getHeading() Returns the heading of the turtle. |
double |
getHeadingInRads() |
Object |
getLabel() Returns the label. |
double |
getLabelColor() Returns the label color for a turtle or link. |
int |
getMaxPxcor() Returns the maximum x coordinate for all patches. |
int |
getMaxPycor() Returns the maximum y coordinate for all patches. |
int |
getMinPxcor() Returns the minimum x coordinate for all patches. |
int |
getMinPycor() Returns the minimum y coordinate for all patches. |
Observer |
getMyObserver() |
TurtleFactory |
getMyTurtleFactory() |
double |
getPcolor() Returns the color of patch here. |
int |
getPenMode() Returns the pen setting of a turtle. |
int |
getPenSize() Returns the pen width of a turtle. |
int |
getPxcor() Returns the x coordinate of patch here. |
int |
getPycor() Returns the y coordinate of patch here. |
String |
getShape() Returns the shape of a turtle. |
double |
getSize() Returns the size of a turtle. |
NdPoint |
getTurtleLocation() |
String |
getTurtleType() |
int |
getWho() Returns the id number of a turtle. |
static int |
getWhoCounter() |
double |
getXcor() Returns the x coordinate of a turtle. |
double |
getYcor() Returns the y coordinate of a turtle. |
AgentSet |
hatch(Number number) Makes a number of new turtles. |
AgentSet |
hatch(Number number, Closure closure) Makes a number of new turtles and then executes a set of commands on the created turtles. |
AgentSet |
hatch(Number number, Closure closure, String childType) Makes a number of new turtles of a specific type and then executes a set of commands on the created turtles. |
AgentSet |
hatch(Number number, Closure closure, Class childType) Makes a number of new turtles of a specific type and then executes a set of commands on the created turtles. |
void |
hideTurtle() Turtle appears hidden. |
void |
home() Turtle goes to (0,0). |
void |
ht() Turtle appears hidden. |
AgentSet |
inCone(Collection a, Number num, Number angle) Returns an agentset within a distance and heading cone of the caller. |
Link |
inLinkFrom(Turtle t) Returns the directed link from a turtle to the caller. |
boolean |
inLinkNeighborQ(Turtle t) Queries if there is a directed link from a turtle to the caller. |
AgentSet |
inLinkNeighbors() Returns the agentset with directed links to the caller. |
AgentSet |
inRadius(Collection a, Number num) Returns an agentset within a distance of the caller. |
boolean |
isHiddenQ() Queries if caller is hidden. |
boolean |
isShapeChanged() |
boolean |
isVisibilityChanged() |
void |
jump(Number num) Moves turtle forward num units. |
void |
left(Number num) Rotates the turtle to the left num degrees. |
Link |
link(Number oneEnd, Number otherEnd) Returns the link between two turtles. |
Link |
link(Turtle oneEnd, Turtle otherEnd) Returns the link between two turtles. |
boolean |
linkNeighborQ(Turtle t) Reports true if there is an undirected link connecting t and the caller. |
AgentSet |
linkNeighbors() Reports the agentset of all turtles found at the other end of undirected links connected to the calling turtle. |
Link |
linkWith(Turtle t) Report the link between t and the caller. |
AgentSet |
links() {@inheritDoc} |
void |
lt(Number num) Rotates the turtle to the left num degrees. |
AgentSet |
maxNOf(int number, Collection a, Closure closure) Returns an agentset consisting of a specified number of agents which have the greatest value when operated on by a set of commands. |
ReLogoAgent |
maxOneOf(Collection a, Closure closure) Returns the ReLogoAgent with the largest value when operated on by a set of commands. |
AgentSet |
minNOf(int number, Collection a, Closure closure) Returns an agentset consisting of a specified number of agents which have the lowest value when operated on by a set of commands. |
ReLogoAgent |
minOneOf(Collection a, Closure closure) Returns the ReLogoAgent with the smallest value when operated on by a set of commands. |
void |
move(Number nNumber) |
void |
moveTo(Turtle t) Moves a turtle to the same location as turtle t. |
void |
moveTo(Patch p) Moves a turtle to the same location as patch p. |
void |
mv(Number nNumber) |
AgentSet |
myInLinks() {@inheritDoc} |
AgentSet |
myLinks() {@inheritDoc} |
AgentSet |
myOutLinks() {@inheritDoc} |
Object |
myself() The agent that initiated the asking. |
AgentSet |
neighbors() {@inheritDoc} |
AgentSet |
neighbors(int extent) {@inheritDoc} |
AgentSet |
neighbors(int extentX, int extentY) {@inheritDoc} |
AgentSet |
neighbors4() {@inheritDoc} |
AgentSet |
neighbors4(int extent) {@inheritDoc} |
AgentSet |
neighbors4(int extentX, int extentY) {@inheritDoc} |
void |
notifySubscribers() |
Stop |
oldStop() Stops a turtle executing within a command closure. |
AgentSet |
other(Collection a) Returns an agentset minus the caller. |
Turtle |
otherEnd() Returns the turtle opposite the asking link. |
boolean |
outLinkNeighborQ(Turtle t) Queries if there is a directed link from the caller to the turtle. |
AgentSet |
outLinkNeighbors() Returns the agentset of the caller's out link neighbor turtles. |
Link |
outLinkTo(Turtle t) Returns the caller's directed link to a turtle. |
Patch |
patch(Number nX, Number nY) Returns the patch containing a point. |
Patch |
patchAhead(Number distance) Returns the patch that is at a distance ahead of a turtle. |
Patch |
patchAt(Number nX, Number nY) Returns the patch at a direction (nX, nY) from the caller. |
Patch |
patchAtHeadingAndDistance(Number nHeading, Number nDistance) Returns the patch that is at a direction and distance from the caller. |
Patch |
patchHere() Returns the patch where the turtle is located. |
Patch |
patchLeftAndAhead(Number nAngle, Number nDistance) Returns the patch that is at a distance and degrees left from the caller. |
Patch |
patchRightAndAhead(Number nAngle, Number nDistance) Returns the patch that is at a distance and degrees right from the caller. |
AgentSet |
patches() Returns an agentset containing all patches. |
void |
pd() Sets the turtle's pen to draw lines. |
void |
pe() Does nothing, included for translation compatibility. |
void |
penDown() Sets the turtle's pen to draw lines. |
void |
penErase() Does nothing, included for translation compatibility. |
void |
penUp() Sets the turtle's pen to stop drawing lines. |
void |
pu() Sets the turtle's pen to stop drawing lines. |
int |
randomPxcor() Returns a random x coordinate for patches. |
int |
randomPycor() Returns a random y coordinate for patches. |
double |
randomXcor() Returns a random x coordinate for turtles. |
double |
randomYcor() Returns a random y coordinate for turtles. |
void |
registerSubscriber(Turtle t) |
void |
removeFromFixedLeaves(OutOfContextSubject t) |
void |
removeFromFreeLeaves(Turtle o) |
void |
removeSubscriber(Turtle t) |
void |
right(Number num) Rotates the turtle to the right num degrees. |
void |
rt(Number num) Rotates the turtle to the right num degrees. |
void |
run(String string) Interprets a string as commands then runs the commands. |
Object |
runresult(String string) Interprets a string as a command then returns the result. |
Turtle |
self() Returns this turtle, patch, or link. |
void |
setBaseTurtleProperties(Observer observer, TurtleFactory turtleFactory, String turtleShape, double heading, double color, NdPoint loc) |
void |
setColor(Number color) Sets the color of a turtle to the value color. |
void |
setHeading(Number nNum) Sets the heading of the turtle to nNum. |
void |
setHiddenQ(boolean hidden) Sets turtle visibility. |
void |
setLabel(Object label) Sets the label. |
void |
setLabelColor(Number labelColor) Sets the label color for a turtle to labelColor. |
void |
setMyObserver(Observer myObserver) |
void |
setMyTurtleFactory(TurtleFactory myTurtleFactory) |
void |
setMyself(Object o) Sets the agent that initiated the asking to the value o. |
void |
setPcolor(Number color) Sets the color of patch here to pcolor. |
void |
setPenMode(Number penMode) Sets the pen setting of a turtle to penMode. |
void |
setPenSize(Number penSize) Sets the pen width of a turtle to penSize. |
void |
setShape(String shape) Sets the shape of a turtle to shape. |
void |
setShapeChanged(boolean shapeChanged) |
void |
setSize(Number size) Sets the size of a turtle to size. |
void |
setUserDefinedVariables(Turtle parent) |
void |
setVisibilityChanged(boolean visibilityChanged) |
static void |
setWhoCounter(Number whoCounter) |
void |
setXcor(Number number) Sets the x coordinate of a turtle to number. |
void |
setYcor(Number number) Sets the y coordinate of a turtle to number. |
void |
setxy(Number nX, Number nY) Sets the x-y coordinates of a turtle to (nX, nY). |
void |
show(Object value) Prints value with agent identifier to the console. |
void |
showTurtle() Makes turtle visible. |
void |
st() Makes turtle visible. |
String |
toString() This method provides a human-readable name for the agent. |
double |
towards(Turtle t) Returns the direction to turtle t. |
double |
towards(Patch p) Returns the direction to patch p. |
double |
towardsxy(Number nX, Number nY) Returns the direction from a turtle or patch to a point. |
Turtle |
turtle(Number number) Returns the turtle of the given number. |
AgentSet |
turtles() Returns an agentset containing all turtles. |
AgentSet |
turtlesAt(Number nX, Number nY) Returns the agentset on the patch at the direction (ndx, ndy) from the caller. |
AgentSet |
turtlesHere() Returns an agentset of turtles from the patch of the caller. |
AgentSet |
turtlesOn(Patch p) Returns an agentset of turtles on a given patch. |
AgentSet |
turtlesOn(Turtle t) Returns an agentset of turtles on the same patch as a turtle. |
AgentSet |
turtlesOn(Collection a) Returns an agentset of turtles on the patches in a collection or on the patches that a collection of turtles are. |
void |
update(Turtle o) |
void |
watchMe() Does nothing, included for translation compatibility. |
int |
worldHeight() Returns the height of the world. |
int |
worldWidth() Returns the width of the world. |
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
Queries if all agents in a collection are true for a boolean closure.
a
- a collection of ReLogoAgentsclosure
- a boolean closureExecutes a set of commands for an agentset in random order.
a
- an agentsetaskBlock
- a set of commandsExecutes a set of commands for a collection of agents.
c
- a collection of agentsaskBlock
- a set of commandsExecutes a set of commands for a turtle.
t
- a turtleaskBlock
- a set of commandsExecutes a set of commands for a patch.
p
- a patchaskBlock
- a set of commandsExecutes a set of commands for a link.
l
- a linkaskBlock
- a set of commandsSteps turtle backwards by a distance.
num
- a distanceSteps turtle backwards by a distance.
num
- a distanceQueries if turtle can move a distance.
nDist
- a distanceMakes a directed link from a turtle to the caller.
t
- a turtleMakes a directed link from a turtle to the caller then executes a set of commands on the created link.
t
- a turtleclosure
- a set of commandsMakes a directed link from the caller to a turtle.
t
- a turtleMakes a directed link from the caller to a turtle then executes a set of commands on the created link.
t
- a turtleclosure
- a set of commandsMakes a undirected link between the caller and a turtle.
t
- a turtleMakes an undirected link between the caller and a turtle then executes a set of commands on the created link.
t
- a turtleclosure
- a set of commandsMakes directed links from a collection of agents to the caller.
a
- a collection of agentsMakes directed links from a collection of turtles to the caller then executes a set of commands on the created links.
a
- a collection of agentsclosure
- a set of commandsMakes directed links from the caller to a collection of agents.
a
- a collection of agentsMakes directed links from the caller to a collection of agents then executes a set of commands on the created links.
a
- a collection of agentsclosure
- a set of commandsMakes undirected links between the caller and a collection of agents.
a
- an collection of agentsMakes undirected links between the caller and a collection of agents then executes a set of commands on the created links.
a
- a collection of agentsclosure
- a set of commandsRemoves the turtle.
Returns the distance from the caller to a turtle.
t
- a turtleReturns the distance from the caller to a patch.
p
- a patchReturns the distance from the caller to a point.
nx
- a numberny
- a numberReturns the turtle's x increment for one step.
Returns the turtle's y increment for one step.
Faces the caller towards a turtle.
t
- a turtleFaces the caller towards a patch.
p
- a patchFaces the caller towards a point.
nX
- x coordinatenY
- y coordinateSteps turtle forward by a distance.
num
- a distancePrints value with agent identifier to current file with a newline.
value
- any objectSteps turtle forward by a distance.
num
- a distanceReturns the color of a turtle. @ returns color of a turtle in the range [0, 140)
Returns the heading of the turtle. @ return heading of the turtle in the range [0, 360)
Returns the label.
Returns the label color for a turtle or link. @ returns label color in the range [0, 140)
Returns the maximum x coordinate for all patches.
Returns the maximum y coordinate for all patches.
Returns the minimum x coordinate for all patches.
Returns the minimum y coordinate for all patches.
Returns the color of patch here.
Returns the pen setting of a turtle.
Returns the pen width of a turtle.
Returns the x coordinate of patch here.
Returns the y coordinate of patch here.
Returns the shape of a turtle.
Returns the size of a turtle.
Returns the id number of a turtle.
Returns the x coordinate of a turtle.
Returns the y coordinate of a turtle.
Makes a number of new turtles.
number
- a numberMakes a number of new turtles and then executes a set of commands on the created turtles.
number
- a numberclosure
- a set of commandsMakes a number of new turtles of a specific type and then executes a set of commands on the created turtles.
number
- a numberclosure
- a set of commandschildType
- a stringMakes a number of new turtles of a specific type and then executes a set of commands on the created turtles.
number
- a numberclosure
- a set of commandschildType
- a turtle classTurtle appears hidden.
Turtle goes to (0,0).
Turtle appears hidden.
Returns an agentset within a distance and heading cone of the caller.
a
- a collection of agentsnum
- a distanceanlge
- the cone angle centered on caller's headingReturns the directed link from a turtle to the caller.
t
- a turtleQueries if there is a directed link from a turtle to the caller.
t
- a turtleReturns the agentset with directed links to the caller.
Returns an agentset within a distance of the caller.
a
- a collection of agentsnum
- a distanceQueries if caller is hidden.
Moves turtle forward num units.
num
- a numberRotates the turtle to the left num degrees.
num
- an angle in degrees in the range [0, 360]Returns the link between two turtles.
oneEnd
- an integerotherEnd
- an integerReturns the link between two turtles.
oneEnd
- a turtleotherEnd
- a turtleReports true if there is an undirected link connecting t and the caller.
Reports the agentset of all turtles found at the other end of undirected links connected to the calling turtle.
Report the link between t and the caller. If no link exists then it reports null.
{@inheritDoc}
Rotates the turtle to the left num degrees.
num
- an angle in degrees in the range [0, 360]Returns an agentset consisting of a specified number of agents which have the greatest value when operated on by a set of commands.
number
- an integera
- a collectionclosure
- a set of commandsReturns the ReLogoAgent with the largest value when operated on by a set of commands.
a
- a collectionclosure
- a set of commandsReturns an agentset consisting of a specified number of agents which have the lowest value when operated on by a set of commands.
number
- an integera
- a collectionclosure
- a set of commandsReturns the ReLogoAgent with the smallest value when operated on by a set of commands.
a
- a collectionclosure
- a set of commandsMoves a turtle to the same location as turtle t.
t
- a turtleMoves a turtle to the same location as patch p.
p
- a patch{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
The agent that initiated the asking.
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
Stops a turtle executing within a command closure.
Returns an agentset minus the caller.
a
- an agentsetReturns the turtle opposite the asking link.
Queries if there is a directed link from the caller to the turtle.
t
- a turtleReturns the agentset of the caller's out link neighbor turtles.
Returns the caller's directed link to a turtle.
t
- a turtleReturns the patch containing a point.
nX
- x coordinatenY
- y coordinateReturns the patch that is at a distance ahead of a turtle.
distance
- a numberReturns the patch at a direction (nX, nY) from the caller.
nX
- a numbernY
- a numberReturns the patch that is at a direction and distance from the caller.
nHeading
- a numbernDistance
- a numberReturns the patch where the turtle is located.
Returns the patch that is at a distance and degrees left from the caller.
nAngle
- an angle in degreesnDistance
- a numberReturns the patch that is at a distance and degrees right from the caller.
nAngle
- an angle in degreesnDistance
- a numberReturns an agentset containing all patches.
Sets the turtle's pen to draw lines.
Does nothing, included for translation compatibility.
Sets the turtle's pen to draw lines.
Does nothing, included for translation compatibility.
Sets the turtle's pen to stop drawing lines.
Sets the turtle's pen to stop drawing lines.
Returns a random x coordinate for patches.
Returns a random y coordinate for patches.
Returns a random x coordinate for turtles.
Returns a random y coordinate for turtles.
Rotates the turtle to the right num degrees.
num
- an angle in degrees in the range [0, 360]Rotates the turtle to the right num degrees.
num
- an angle in degrees in the range [0, 360]Interprets a string as commands then runs the commands.
string
- a stringInterprets a string as a command then returns the result.
string
- a stringReturns this turtle, patch, or link.
Sets the color of a turtle to the value color.
color
- a numberSets the heading of the turtle to nNum.
nNum
- a number in degreesSets turtle visibility.
hidden
- boolean visibilitySets the label.
label
- a labelSets the label color for a turtle to labelColor.
labelColor
- a number in range [0, 140)Sets the agent that initiated the asking to the value o.
o
- an objectSets the color of patch here to pcolor.
pcolor
- a number in range [0,140)Sets the pen setting of a turtle to penMode.
penMode
- a pen mode, PEN_UP or PEN_DOWNSets the pen width of a turtle to penSize.
penSize
- a numberSets the shape of a turtle to shape.
shape
- a stringSets the size of a turtle to size.
size
- a numberSets the x coordinate of a turtle to number.
number
- a numberSets the y coordinate of a turtle to number.
number
- a numberSets the x-y coordinates of a turtle to (nX, nY).
nX
- a numbernY
- a numberPrints value with agent identifier to the console.
value
- any objectMakes turtle visible.
Makes turtle visible.
This method provides a human-readable name for the agent.
Returns the direction to turtle t.
t
- a turtleReturns the direction to patch p.
p
- a patchReturns the direction from a turtle or patch to a point.
nX
- a numbernY
- a numberReturns the turtle of the given number.
number
- a numberReturns an agentset containing all turtles.
Returns the agentset on the patch at the direction (ndx, ndy) from the caller.
nX
- a numbernY
- a numberReturns an agentset of turtles from the patch of the caller.
Returns an agentset of turtles on a given patch.
p
- a patchReturns an agentset of turtles on the same patch as a turtle.
t
- a turtleReturns an agentset of turtles on the patches in a collection or on the patches that a collection of turtles are.
a
- a collectionDoes nothing, included for translation compatibility.
Returns the height of the world.
Returns the width of the world.