|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A turtle is an agent in the turtle mechanism. The turtle mechanism is based on Logo and NetLogo. The abbreviated version of a turtle command (fd bk rt lt) should be used instead of the unabbreviated command.
NetLogo website http://ccl.northwestern.edu/netlogo/
TODO add (May 15 2007):
beep
downhill
downhill4
inCone
inRadius
patchAhead
patchAt
patchAtHeadingAndDistance
patchHere
patchLeftAndAhead
patchRightAndAhead
stamp
stampErase
turtlesAt
turtlesHere
turtlesOn
uphill
uphill4
with
| Field Summary | |
static int |
COMMANDID_NONE
|
static int |
FILTERID_NONE
|
static int |
PENMODE_DOWN
|
static int |
PENMODE_ERASE
|
static int |
PENMODE_UP
|
static int |
WHENMOVED_INIT
|
| Fields inherited from interface org.primordion.xholon.base.IXholon |
DEFAULT_SIZE_MSG_Q, NINCLUDE_PSC, NINCLUDE_PSx, NINCLUDE_PxC, NINCLUDE_Pxx, NINCLUDE_xSC, NINCLUDE_xSx, NINCLUDE_xxC, NINCLUDE_xxx |
| Method Summary | |
void |
aggregate(double amount)
Aggregate by keeping a count of the number of individuals of a given "breed". |
void |
back(double distance)
Move back a given distance. |
void |
beep()
Make a single short beep sound. |
void |
bk(double distance)
Move back a given distance. |
boolean |
canMove(double distance)
Can this turtle legally move the specified distance, given its current heading? |
void |
die()
Remove yourself permanently from the gene pool. |
double |
distance(IXholon turtleOrPatch)
Return the distance between self and the specified turtle or patch. |
double |
distancexy(double x,
double y)
Return the distance between yourself and the specified x, y coordinates. |
double |
downhill()
"Return the turtle heading in the direction of the minimum value of the variable patch-variable, of the patches in a one-patch radius of the turtle." |
double |
downhill4()
"Return the turtle heading in the direction of the minimum value of the variable patch-variable, of the patches in a one-patch radius of the turtle." |
double |
dx()
Returns the delta in the x direction if the turtle moved one unit along its current heading. |
double |
dy()
Returns the delta in the y direction if the turtle moved one unit along its current heading. |
void |
face(IXholon turtleOrPatch)
Turn to face the specified turtle or patch. |
void |
facexy(double x,
double y)
Turn to face the specified x, y coordinates. |
void |
fd(double distance)
Move forward a given distance. |
void |
forward(double distance)
Move forward a given distance. |
int |
getBreed()
Get the turtle's breed id. |
int |
getColor()
Get the turtle's color. |
double |
getHeading()
Get the turtle's heading. |
boolean |
getIsHidden()
Get the turtle's hide status. |
java.lang.String |
getLabel()
Get the turtle's label, a String that helps to identify it. |
int |
getMaxPxcor()
Return the maximum Patch x coordinate. |
int |
getMaxPycor()
Return the maximum Patch y coordinate. |
int |
getMinPxcor()
Return the minimum Patch x coordinate. |
int |
getMinPycor()
Return the minimum Patch y coordinate. |
int |
getPcolor()
Get the patch's pcolor. |
int |
getPenMode()
Get the turtle's pen mode. |
java.lang.String |
getPlabel()
Get the patch's label, a String that helps to identify it. |
int |
getPxcor()
Get the patch's x coordinate. |
int |
getPycor()
Get the patch's y coordinate. |
int |
getWho()
Get the turtle's who id. |
int |
getWorldHeight()
Return the height of the world (the grid height). |
int |
getWorldWidth()
Return the width of the world (the grid width). |
double |
getXcor()
Get the turtle's x coordinate. |
double |
getYcor()
Get the turtle's y coordinate. |
boolean |
hasAlreadyMoved()
Has this turtle already moved this time step? This method is required to prevent turtles from moving multiple times in the same time step, which would happen when a turtle moves to a patch that hasn't yet been reached in the tree traversal this time step. |
void |
hatch(int numTurtles,
int commandId)
Hatch a specified number of new turtles, each identical to this turtle. |
void |
hideTurtle()
Hide from view. |
void |
home()
Go home, by returning to the home coordinates. |
void |
ht()
Hide from view. |
java.util.Vector |
inCone(double distance,
double angle)
Return agents that fall within a cone defined by the distance and angle . |
void |
initWhenMoved(int when)
Initialize the whenMoved variable. |
java.util.Vector |
inRadius(int radius)
Return a list of all neighbors (turtles) within the specified radius. |
java.util.Vector |
inRadius(int radius,
int filterId)
Return a list of all neighbors (turtles) within the specified radius. |
void |
jump(double distance)
Jump forward a given distance, without effecting any intervening patches or turtles. |
void |
jump(IPatch aPatch)
Jump directly to the specified patch. |
void |
jump(ITurtle aTurtle)
Jump directly to the patch that the specified turtle is currently in. |
void |
left(double angle)
Turn left a given angle. |
void |
lt(double angle)
Turn left a given angle. |
java.util.Vector |
neighbors()
Return the 8 surrounding neighbor patches. |
java.util.Vector |
neighbors4()
Return the 4 surrounding neighbor patches. |
java.util.Vector |
otherTurtlesHere()
Return all other turtles that are also currently located at this turtle's patch. |
IPatch |
patchAhead(double distance)
Return the single patch that is the given distance along the turtle's current heading. |
IPatch |
patchAt(int dx,
int dy)
Return the single patch at the specified x and y relative distance. |
IPatch |
patchAtHeadingAndDistance(double heading,
double distance)
Return the single patch at the specified absolute heading and relative distance. |
IPatch |
patchHere()
Return the patch that the turtle is currently on. |
IPatch |
patchLeftAndAhead(double distance,
double angle)
Return the single patch that is the given distance from the turtle, in the direction turned left the given angle from the turtle's current heading. |
IPatch |
patchRightAndAhead(double distance,
double angle)
Return the single patch that is the given distance from the turtle, in the direction turned right the given angle from the turtle's current heading. |
void |
pd()
Set the pen down, so it is able to draw. |
void |
pe()
Set the pen to erase. |
void |
penDown()
Set the pen down, so it is able to draw. |
void |
penErase()
Set the pen to erase. |
void |
penUp()
Set the pen up, so it is unable to draw. |
void |
pu()
Set the pen up, so it is unable to draw. |
void |
right(double angle)
Turn right a given angle. |
void |
rt(double angle)
Turn right a given angle. |
void |
setBreed(int breed)
Set or change the turtle's breed id. |
void |
setColor(int color)
Set the turtle's color. |
void |
setHeading(double heading)
Set the turtle's heading. |
void |
setIsHidden(boolean isHidden)
Set the turtle's hide status. |
void |
setLabel(java.lang.String label)
Set or change the turtle's label. |
void |
setPcolor(int pcolor)
Set the patch's pcolor. |
void |
setPenMode(int penMode)
Set the turtle's pen mode. |
void |
setPlabel(java.lang.String plabel)
Set or change the patch's label. |
void |
setPxcor(int pxcor)
Set the patch's x coordinate. |
void |
setPycor(int pycor)
Set the patch's y coordinate. |
void |
setWho(int who)
Set the turtle's who id. |
void |
setXcor(double xcor)
Set the turtle's x coordinate. |
void |
setxy(double x,
double y)
Set the turtle's x and y coordinates, and move to that location. |
void |
setYcor(double ycor)
Set the turtle's y coordinate. |
void |
showTurtle()
Show in the viewer. |
void |
st()
Show in the viewer. |
void |
stamp()
Leave an inprint or stamp of self at the current patch. |
void |
stampErase()
Erase any inprint or stamp at the current patch. |
double |
towards(IXholon turtleOrPatch)
Return the heading between self and the specified turtle or patch. |
double |
towardsxy(double x,
double y)
Return the heading between self and the specified x, y coordinates. |
java.util.Vector |
turtlesAt(int dx,
int dy)
Return the turtles located at the single patch at the specified x and y relative distance. |
java.util.Vector |
turtlesHere()
Return the turtles located at the current patch. |
java.util.Vector |
turtlesOn()
Return the turtles that are on the given patch or patches, or standing on the same patch as the given turtle or turtles. |
double |
uphill()
"Return the turtle heading in the direction of the maximum value of the variable patch-variable, of the patches in a one-patch radius of the turtle." |
double |
uphill4()
"Return the turtle heading in the direction of the maximum value of the variable patch-variable, of the patches in a one-patch radius of the turtle." |
java.util.Vector |
with(java.util.Vector vIn,
int filterId)
Filters the input vector to produce an output vector. |
| Field Detail |
public static final int PENMODE_UP
public static final int PENMODE_DOWN
public static final int PENMODE_ERASE
public static final int WHENMOVED_INIT
public static final int COMMANDID_NONE
public static final int FILTERID_NONE
| Method Detail |
public void back(double distance)
distance - A distance measured in units.public void bk(double distance)
distance - A distance measured in units.public void beep()
public boolean canMove(double distance)
distance - A distance measured in units.
public void die()
public double distance(IXholon turtleOrPatch)
turtleOrPatch - A turtle or patch object.
public double distancexy(double x,
double y)
x - A global x coordinate.y - A global y coordinate.
public double downhill()
public double downhill4()
public double dx()
public double dy()
public void face(IXholon turtleOrPatch)
turtleOrPatch - A turtle or patch object.
public void facexy(double x,
double y)
x - A global x coordinate.y - A global y coordinate.public void forward(double distance)
distance - A distance measured in units.public void fd(double distance)
distance - A distance measured in units.
public void hatch(int numTurtles,
int commandId)
numTurtles - The number of new turtles to hatch.commandId - The ID of a set of turtle commands that can be executed.
by calling performActivity(int commandId) on each new turtle.public void hideTurtle()
public void ht()
public void home()
public java.util.Vector inCone(double distance,
double angle)
distance - A distance measured in units.angle - An angle measured in degrees.
public java.util.Vector inRadius(int radius)
radius - Distance from the current patch. The current patch is a radius of 0 from itself.
public java.util.Vector inRadius(int radius,
int filterId)
radius - Distance from the current patch. The current patch is a radius of 0 from itself.filterId - An ID that can be used by performBooleanActivity() to select a specific filter.
public void jump(double distance)
distance - A distance measured in units.public void jump(IPatch aPatch)
aPatch - A patch.public void jump(ITurtle aTurtle)
aTurtle - A turtle.public void left(double angle)
angle - An angle measured in degrees.public void lt(double angle)
angle - A relative angle measured in degrees.public java.util.Vector neighbors()
public java.util.Vector neighbors4()
public java.util.Vector otherTurtlesHere()
public IPatch patchAhead(double distance)
distance - A distance measured in units.
public IPatch patchAt(int dx,
int dy)
dx - A relative distance in the x direction, in patches.dy - A relative distance in the y direction, in patches.
public IPatch patchAtHeadingAndDistance(double heading,
double distance)
heading - An absolute angle measured in degrees.distance - A distance measured in units.
public IPatch patchHere()
public IPatch patchLeftAndAhead(double distance,
double angle)
distance - A distance measured in units.angle - An angle measured in degrees.
public IPatch patchRightAndAhead(double distance,
double angle)
distance - A distance measured in units.angle - An angle measured in degrees.
public void penDown()
public void pd()
public void penErase()
public void pe()
public void penUp()
public void pu()
public void right(double angle)
angle - An angle measured in degrees.public void rt(double angle)
angle - A relative angle measured in degrees.
public void setxy(double x,
double y)
x - New value for the turtle's x coordinate.y - New value for the turtle's y coordinate.public void showTurtle()
public void st()
public void stamp()
public void stampErase()
public double towards(IXholon turtleOrPatch)
turtleOrPatch - A turtle or patch object.
public double towardsxy(double x,
double y)
x - A global x coordinate.y - A global y coordinate.
public java.util.Vector turtlesAt(int dx,
int dy)
dx - A relative distance in the x direction, in patches.dy - A relative distance in the y direction, in patches.
public java.util.Vector turtlesHere()
public java.util.Vector turtlesOn()
public double uphill()
public double uphill4()
public java.util.Vector with(java.util.Vector vIn,
int filterId)
vIn - A collection of ITurtle instances.
public int getBreed()
public void setBreed(int breed)
breed - A breed id.public int getColor()
public void setColor(int color)
color - A color value, as defined in ITurtlePatchColor.public double getHeading()
public void setHeading(double heading)
heading - An absolute angle measured in degrees.public boolean getIsHidden()
public void setIsHidden(boolean isHidden)
isHidden - hidden (true) or visible (false)public java.lang.String getLabel()
public void setLabel(java.lang.String label)
label - public int getPenMode()
public void setPenMode(int penMode)
penMode - A pen mode, one of PENMODE_UP, PENMODE_DOWN, or PENMODE_ERASE.public int getWho()
public void setWho(int who)
who - A who id.public double getXcor()
public void setXcor(double xcor)
xcor - An xcor value.public double getYcor()
public void setYcor(double ycor)
ycor - An ycor value.public int getPcolor()
public void setPcolor(int pcolor)
pcolor - A pcolor value, as defined in ITurtlePatchColor.public java.lang.String getPlabel()
public void setPlabel(java.lang.String plabel)
public int getPxcor()
public void setPxcor(int pxcor)
public int getPycor()
public void setPycor(int pycor)
public int getMaxPxcor()
public int getMaxPycor()
public int getMinPxcor()
public int getMinPycor()
public int getWorldWidth()
public int getWorldHeight()
public boolean hasAlreadyMoved()
public void initWhenMoved(int when)
when - A time step, normally WHENMOVED_INIT (-1).public void aggregate(double amount)
amount - The amount to increment or decrement the current population count.
The amount can be a positive (increment) or negative (decrement) number.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||