RepastHPC
2.3.1
|
Relogo Turtle implementation. More...
#include <Turtle.h>
Public Member Functions | |
Turtle (repast::AgentId id, Observer *observer) | |
Creates a Turtle that will have the specified id, and be managed by the specified Observer. | |
virtual void | hatchCopy (RelogoAgent *parent) |
void | xCor (double x) |
Sets the x coordinate of the Turtle's location. More... | |
void | yCor (double y) |
Sets the y coordinate of the Turtle's location. More... | |
void | setxy (double x, double y) |
Sets the x and y coordinate of the Turtle's location. More... | |
virtual int | pxCor () const |
Gets the Patch x coordinate of this Turtle. More... | |
virtual int | pyCor () const |
Gets the Patch x coordinate of this Turtle. More... | |
void | die () |
Removes this turtle from the world. More... | |
void | createLinkWith (Turtle *turtle, const std::string &network=DEFAULT_UNDIR_NET) |
Creates a link between this turtle and the specified turtle in the specified undirected network. More... | |
template<typename LinkCreator > | |
void | createLinkWithLC (Turtle *turtle, LinkCreator &creator, const std::string &network=DEFAULT_UNDIR_NET) |
Creates a link between this turtle and the specified turtle in the specified undirected network, using the specified linke creator. More... | |
template<typename AgentType > | |
void | createLinksWith (AgentSet< AgentType > &agents, const std::string &network=DEFAULT_UNDIR_NET) |
Creates links between this turtle and all the agents in the AgentSet in the named network. More... | |
template<typename AgentType , typename LinkCreator > | |
void | createLinksWithLC (AgentSet< AgentType > &agents, LinkCreator &creator, const std::string &network=DEFAULT_UNDIR_NET) |
Creates links between this turtle and all the agents in the agentset using the link creator and in the named network. More... | |
void | createLinkFrom (Turtle *turtle, const std::string &network=DEFAULT_DIR_NET) |
Creates a link to this Turtle from the specified turtle in the named network which defaults to the default directed network. More... | |
template<typename LinkCreator > | |
void | createLinkFromLC (Turtle *turtle, LinkCreator &linkCreator, const std::string &network=DEFAULT_DIR_NET) |
Creates a link to this Turtle from the specified turtle in the named network which defaults to the default directed network. More... | |
template<typename AgentType > | |
void | createLinksFrom (AgentSet< AgentType > &agents, const std::string &network=DEFAULT_DIR_NET) |
Creates links to this turtle from all the agents in the agentset in the named network. More... | |
template<typename AgentType , typename LinkCreator > | |
void | createLinksFromLC (AgentSet< AgentType > &agents, LinkCreator &creator, const std::string &network=DEFAULT_DIR_NET) |
Creates links to this turtle from all the agents in the agentset using the link creator and in the named network. More... | |
template<typename AgentType > | |
void | createLinksTo (AgentSet< AgentType > &agents, const std::string &network=DEFAULT_DIR_NET) |
Creates links from this turtle to all the agents in the agentset in the named network. More... | |
template<typename AgentType , typename LinkCreator > | |
void | createLinksToLC (AgentSet< AgentType > &agents, LinkCreator &creator, const std::string &network=DEFAULT_DIR_NET) |
Creates links from this turtle to all the agents in the agentset using the link creator and in the named network. More... | |
void | createLinkTo (Turtle *turtle, const std::string &network=DEFAULT_DIR_NET) |
Creates a link from this Turtle to the specified turtle in the named network which defaults to the default directed network. More... | |
template<typename LinkCreator > | |
void | createLinkToLC (Turtle *turtle, LinkCreator &linkCreator, const std::string &network=DEFAULT_DIR_NET) |
Creates a link from this Turtle to the specified turtle in the named network which defaults to the default directed network. More... | |
boost::shared_ptr< RelogoLink > | inLinkFrom (Turtle *turtle, const std::string &name=DEFAULT_DIR_NET) |
Gets the link from the specified turtle to this one in the specified network which defaults to the default directed network. More... | |
boost::shared_ptr< RelogoLink > | outLinkTo (Turtle *turtle, const std::string &name=DEFAULT_DIR_NET) |
Gets the link from the this turtle to the specified turtle in the specified network which defaults to the default directed network. More... | |
boost::shared_ptr< RelogoLink > | linkWith (Turtle *turtle, const std::string &name=DEFAULT_UNDIR_NET) |
Gets the link between this turtle and the specified on in the named undirected network. More... | |
bool | linkNeighborQ (Turtle *turtle, const std::string &name=DEFAULT_UNDIR_NET) |
Gets whether or not this turtle is linked to the specified turtle, in the specified network. More... | |
template<typename AgentType > | |
void | linkNeighbors (AgentSet< AgentType > &out, const std::string &name=DEFAULT_UNDIR_NET) |
Gets all the network neighbors of this turtle in the named network and puts them in the specified AgentSet. More... | |
bool | inLinkNeighborQ (Turtle *turtle, const std::string &name=DEFAULT_DIR_NET) |
Gets whether or not there is an edge into this turtle from the specified turtle, in the specified network. More... | |
template<typename AgentType > | |
void | inLinkNeighbors (AgentSet< AgentType > &out, const std::string &name=DEFAULT_DIR_NET) |
Gets all the network predecessors of this turtle in the named network and puts them in the specified array list. More... | |
bool | outLinkNeighborQ (Turtle *turtle, const std::string &name=DEFAULT_DIR_NET) |
Gets whether or not there is an edge from this turtle to the specified turtle, in the specified network. More... | |
template<typename AgentType > | |
void | outLinkNeighbors (AgentSet< AgentType > &out, const std::string &name=DEFAULT_DIR_NET) |
Gets all the network successors of this turtle in the named network and puts them in the specified array list. More... | |
void | moveTo (Turtle *turtle) |
Moves this turtle to the location of the specified turtle. More... | |
void | moveTo (Patch *patch) |
Moves this turtle to the location of the specified patch. More... | |
void | move (double distance) |
Moves this turtle the specified distance along the current heading. More... | |
void | mv (double distance) |
Moves this turtle the specified distance along the current heading. More... | |
void | jump (double distance) |
Moves this turtle forward the specified distance, if and only if that would not take this turtle outside the current topology. More... | |
void | forward (double distance) |
Moves this turtle forward the specified distance. More... | |
void | backward (double distance) |
Moves this turtle backward the specified distance. More... | |
void | fd (double distance) |
Moves this turtle forward the specified distance. More... | |
void | bk (double distance) |
Moves this turtle backward the specified distance. More... | |
template<typename PatchType , typename ValueGetter > | |
void | downhill (ValueGetter &getter) |
Moves this turtle to a neighboring patch with lowest value as retrieved via the ValueGetter. More... | |
template<typename PatchType , typename ValueGetter > | |
void | downhill4 (ValueGetter &getter) |
Moves this turtle to the patch with lowest value as retrieved via the ValueGetter. More... | |
template<typename PatchType , typename ValueGetter > | |
void | uphill (ValueGetter &getter) |
Moves this turtle to the patch with highest value as retrieved via the ValueGetter. More... | |
template<typename PatchType , typename ValueGetter > | |
void | uphill4 (ValueGetter &getter) |
Moves this turtle to the patch with highest value as retrieved via the ValueGetter. More... | |
double | dx () const |
Gets the distance traveled along the x dimension if the turtle were to take one step forward along its current heading. More... | |
double | dy () const |
Gets the distance traveled along the y dimension if the turtle were to take one step forward along its current heading. More... | |
bool | canMoveQ (double distance) const |
Gets whether or not this turtle can move the specified distance along its current heading given the current topology. More... | |
float | towards (RelogoAgent *agent) const |
Gets the heading from this turtle to the specified RelogoAgent (turtle or patch). More... | |
float | towardsxy (double x, double y) const |
Gets the heading from this turtle to the specified location. More... | |
float | towards (const Point< double > &location) const |
Gets the heading from this turtle to the specified location. More... | |
double | distance (Turtle *turtle) const |
Gets the distance from this turtle to the specified turtle. More... | |
float | heading () const |
Gets this Turtle's current heading. More... | |
void | heading (float heading) |
Sets this turtle's heading to the specified heading. More... | |
template<typename PatchType > | |
PatchType * | patchHere () const |
Gets the patch under this turtle. More... | |
void | face (Turtle *turtle) |
Sets the turtles heading to face towards the specified turtle. More... | |
void | face (Patch *patch) |
Sets the turtles heading to face towards the specified pach. More... | |
void | facexy (double nx, double ny) |
Sets the turtles heading to face the specified coordinates. More... | |
void | left (float degrees) |
Turns the turtle left by the specified number of degrees. More... | |
void | lt (float degrees) |
Turns the turtle left by the specified number of degrees. More... | |
template<typename PatchType > | |
PatchType * | patchLeftAndAhead (float angleInDegrees, double distance) |
Gets the patch that is the specified distance from this turtle, at the specified angle (turning left) from this turtle's heading. More... | |
template<typename PatchType > | |
PatchType * | patchRightAndAhead (float angleInDegrees, double distance) |
Gets the patch that is the specified distance from this turtle, in the specified degrees (turning right) from this turtle's heading. More... | |
double | xCor () const |
Gets the x coordinate of the agent's location. More... | |
double | yCor () const |
Gets the y coordinate of the agent's location. More... | |
Public Member Functions inherited from repast::relogo::AbstractRelogoAgent | |
AbstractRelogoAgent (AgentId id, Observer *observer) | |
template<typename AgentType > | |
void | inRadius (AgentSet< RelogoAgent > &inSet, double radius, AgentSet< AgentType > &outSet) const |
Gets all the agents in the inSet within the specified radius for this RelogoAgent and put them in the outSet. More... | |
template<typename PatchType > | |
PatchType * | patchAt (double dx, double dy) const |
Gets the patch at direction dx, dy from the this agent. More... | |
template<typename AgentType > | |
void | turtlesHere (AgentSet< AgentType > &set) const |
Gets all the turtles on this turtle's patch and puts them into the specifed set. More... | |
template<typename AgentType > | |
AgentSet< AgentType > | turtlesHere () const |
Gets all the turtles on this turtle's patch and returns them in an AgentSet. More... | |
template<typename PatchType > | |
PatchType * | patchAtHeadingAndDistance (float heading, double distance) |
Gets the patch at the specified heading and distance from this patch or turtle. More... | |
template<typename AgentType > | |
void | turtlesOn (AgentSet< AgentType > &out) const |
Gets the turtles that are on this patch or if this is a Turtle get the turtles that are on the patch this turtle is on. More... | |
template<typename AgentType > | |
AgentSet< AgentType > | turtlesOn () const |
Gets the turtles that are on this patch or if this is a Turtle get the turtles that are on the patch this turtle is on. More... | |
Public Member Functions inherited from repast::relogo::RelogoAgent | |
RelogoAgent (repast::AgentId id, Observer *observer) | |
Creates a RelogoAgent with the specified id and managed by the specified Observer. More... | |
virtual repast::AgentId & | getId () |
Gets the id of this RelogoAgent. More... | |
virtual const repast::AgentId & | getId () const |
Gets the const id of this RelogoAgent. More... | |
Point< double > | location () const |
Gets the location of this RelogoAgent. More... | |
virtual void | hatchCopy () |
If this ReLogo agent is 'hatched', makes an appropriate copy, setting instance variables as appropriate. | |
double | xCor () const |
Gets the x coordinate of the agent's location. More... | |
double | yCor () const |
Gets the y coordinate of the agent's location. More... | |
double | distance (RelogoAgent *obj) const |
Gets the distance from this RelogoAgent to the specified agent. More... | |
double | distancexy (double x, double y) const |
Gets the distance from this RelogoAgent to the specified point. More... | |
Additional Inherited Members | |
Protected Attributes inherited from repast::relogo::RelogoAgent | |
Observer * | _observer |
Point< double > | _location |
repast::AgentId | _id |
Relogo Turtle implementation.
|
inline |
Moves this turtle backward the specified distance.
distance | the distance to move |
|
inline |
Moves this turtle backward the specified distance.
distance | the distance to move |
bool repast::relogo::Turtle::canMoveQ | ( | double | distance | ) | const |
Gets whether or not this turtle can move the specified distance along its current heading given the current topology.
void repast::relogo::Turtle::createLinkFrom | ( | Turtle * | turtle, |
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates a link to this Turtle from the specified turtle in the named network which defaults to the default directed network.
turtle | the turtle that will be the source turtle of the lin |
network | the name of the network |
void repast::relogo::Turtle::createLinkFromLC | ( | Turtle * | turtle, |
LinkCreator & | linkCreator, | ||
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates a link to this Turtle from the specified turtle in the named network which defaults to the default directed network.
turtle | the turtle that will be the source turtle of the link |
network | the name of the network |
linkCreator | an object used to create the link |
LinkCreator | an function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target) |
void repast::relogo::Turtle::createLinksFrom | ( | AgentSet< AgentType > & | agents, |
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates links to this turtle from all the agents in the agentset in the named network.
The network defaults to the default directed network.
agents | the agentset of agents to create links from |
network | the name of the network to create the links in. This defaults to the default directed network |
AgentType | the type of object contained by the agentset. |
void repast::relogo::Turtle::createLinksFromLC | ( | AgentSet< AgentType > & | agents, |
LinkCreator & | creator, | ||
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates links to this turtle from all the agents in the agentset using the link creator and in the named network.
The network defaults to the default directed network.
agents | the agentset of agents to create links from |
network | the name of the network to create the links in. This defaults to the default directed network |
AgentType | the type of object contained by the agentset |
LinkCreator | an function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target) |
void repast::relogo::Turtle::createLinksTo | ( | AgentSet< AgentType > & | agents, |
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates links from this turtle to all the agents in the agentset in the named network.
The network defaults to the default directed network.
agents | the agentset of agents to create links to |
network | the name of the network to create the links in. This defaults to the default directed network |
AgentType | the type of object contained by the agentset. |
void repast::relogo::Turtle::createLinksToLC | ( | AgentSet< AgentType > & | agents, |
LinkCreator & | creator, | ||
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates links from this turtle to all the agents in the agentset using the link creator and in the named network.
The network defaults to the default directed network.
agents | the agentset of agents to create links to |
network | the name of the network to create the links in. This defaults to the default directed network |
AgentType | the type of object contained by the agentset |
LinkCreator | an function or functor with the following signature boost::shared_ptr<RelogoLink> (Turtle* source, Turtle* target) |
void repast::relogo::Turtle::createLinksWith | ( | AgentSet< AgentType > & | agents, |
const std::string & | network = DEFAULT_UNDIR_NET |
||
) |
Creates links between this turtle and all the agents in the AgentSet in the named network.
The network defaults to the default undirected network.
agents | the agentset of agents to create links with |
network | the name of the network to create the links in. This defaults to the default undirected network |
Agent | the type of object contained by the agentset. |
void repast::relogo::Turtle::createLinksWithLC | ( | AgentSet< AgentType > & | agents, |
LinkCreator & | creator, | ||
const std::string & | network = DEFAULT_UNDIR_NET |
||
) |
Creates links between this turtle and all the agents in the agentset using the link creator and in the named network.
The network defaults to the default undirected network.
agents | the agentset of agents to create links with |
network | the name of the network to create the links in. This defaults to the default undirected network |
creator | the functor to create the links with |
Agent | the type of object contained by the agentset |
LinkCreator | the object used to create the links |
LinkCreator | an function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target) |
void repast::relogo::Turtle::createLinkTo | ( | Turtle * | turtle, |
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates a link from this Turtle to the specified turtle in the named network which defaults to the default directed network.
turtle | the turtle that will be the target turtle of the link |
network | the name of the network |
void repast::relogo::Turtle::createLinkToLC | ( | Turtle * | turtle, |
LinkCreator & | linkCreator, | ||
const std::string & | network = DEFAULT_DIR_NET |
||
) |
Creates a link from this Turtle to the specified turtle in the named network which defaults to the default directed network.
turtle | the turtle that will be the target turtle of the link |
network | the name of the network |
linkCreator | an object used to create the link |
LinkCreator | an function or functor with the following signature boost::shared_ptr<RelogoLink> (Turtle* source, Turtle* target) |
void repast::relogo::Turtle::createLinkWith | ( | Turtle * | turtle, |
const std::string & | network = DEFAULT_UNDIR_NET |
||
) |
Creates a link between this turtle and the specified turtle in the specified undirected network.
The network defaults to the default undirected network.
turtle | the turtle to create the link with |
network | the network to create the link in |
void repast::relogo::Turtle::createLinkWithLC | ( | Turtle * | turtle, |
LinkCreator & | creator, | ||
const std::string & | network = DEFAULT_UNDIR_NET |
||
) |
Creates a link between this turtle and the specified turtle in the specified undirected network, using the specified linke creator.
The network defaults to the default undirected network.
turtle | the turtle to create the link with |
creator | the functor to create the link with |
network | the network to create the link in |
LinkCreator | an function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target) |
void repast::relogo::Turtle::die | ( | ) |
double repast::relogo::Turtle::distance | ( | Turtle * | turtle | ) | const |
Gets the distance from this turtle to the specified turtle.
turtle | the turtle to get the distance to |
void repast::relogo::Turtle::downhill | ( | ValueGetter & | getter | ) |
Moves this turtle to a neighboring patch with lowest value as retrieved via the ValueGetter.
The 8 neighboring patches and the current patch the turtle is on are considered. If no surrounding patch has a lower value than the patch the turtle is on, this turtle stays on the current patch. If there is more than one patch with the minimum value, then one will be chosen at random.Note that this turtle will end up in the center of one of the surrounding patches or in the center of its current patch.
getter | the function or functor used to retrieve the value from the patch |
PatchType | the patch's type |
a | functor or function with the following signature double (PatchType* patch) const |
void repast::relogo::Turtle::downhill4 | ( | ValueGetter & | getter | ) |
Moves this turtle to the patch with lowest value as retrieved via the ValueGetter.
The 4 neighboring patches and the current patch the turtle is on are considered. If no surrounding patch has a lower value than the patch the turtle is on, this turtle stays on the current patch. If there is more than on patch with the minimum value, then one will be chosen at random. This considers only the current patch and the 4 surrounding patches (N, S, E, W).
Note that this turtle will end up in the center of one of the surrounding patches or in the center of its current patch.
getter | the function or functor used to retrieve the value from the patch |
PatchType | the patch's type |
a | functor or function with the following signature double (PatchType* patch) const |
double repast::relogo::Turtle::dx | ( | ) | const |
Gets the distance traveled along the x dimension if the turtle were to take one step forward along its current heading.
double repast::relogo::Turtle::dy | ( | ) | const |
Gets the distance traveled along the y dimension if the turtle were to take one step forward along its current heading.
void repast::relogo::Turtle::face | ( | Patch * | patch | ) |
Sets the turtles heading to face towards the specified pach.
patch | the patch to face |
void repast::relogo::Turtle::face | ( | Turtle * | turtle | ) |
Sets the turtles heading to face towards the specified turtle.
turtle | the turtle to face |
void repast::relogo::Turtle::facexy | ( | double | nx, |
double | ny | ||
) |
Sets the turtles heading to face the specified coordinates.
nx | the x coordinate of the location to face |
ny | the y coordinate of the location to face |
|
inline |
Moves this turtle forward the specified distance.
distance | the distance to move |
|
inline |
Moves this turtle forward the specified distance.
distance | the distance to move |
|
inline |
void repast::relogo::Turtle::heading | ( | float | heading | ) |
Sets this turtle's heading to the specified heading.
heading | the new heading |
boost::shared_ptr< RelogoLink > repast::relogo::Turtle::inLinkFrom | ( | Turtle * | turtle, |
const std::string & | name = DEFAULT_DIR_NET |
||
) |
Gets the link from the specified turtle to this one in the specified network which defaults to the default directed network.
turtle | the turtle to get the link from |
name | the name of the network containing the link |
bool repast::relogo::Turtle::inLinkNeighborQ | ( | Turtle * | turtle, |
const std::string & | name = DEFAULT_DIR_NET |
||
) |
Gets whether or not there is an edge into this turtle from the specified turtle, in the specified network.
The network defaults to the default directed network.
turtle | the turtle to check as the source of the edge |
name | the name of the network to check, defaults to the default directed network. |
void repast::relogo::Turtle::inLinkNeighbors | ( | AgentSet< AgentType > & | out, |
const std::string & | name = DEFAULT_DIR_NET |
||
) |
Gets all the network predecessors of this turtle in the named network and puts them in the specified array list.
out | the AgentSet to the return the neighbors in |
name | the name of the network to get the network neighbors from |
AgentType | the type of agents to find in the network |
|
inline |
Moves this turtle forward the specified distance, if and only if that would not take this turtle outside the current topology.
distance | the amount to move |
void repast::relogo::Turtle::left | ( | float | degrees | ) |
Turns the turtle left by the specified number of degrees.
To turn right, use a negative number.
degrees | the amount to turn |
bool repast::relogo::Turtle::linkNeighborQ | ( | Turtle * | turtle, |
const std::string & | name = DEFAULT_UNDIR_NET |
||
) |
Gets whether or not this turtle is linked to the specified turtle, in the specified network.
The network defaults to the default undirected network.
turtle | the turtle to check that this links to |
name | the name of the network to check, defaults to the default undirected network. |
void repast::relogo::Turtle::linkNeighbors | ( | AgentSet< AgentType > & | out, |
const std::string & | name = DEFAULT_UNDIR_NET |
||
) |
boost::shared_ptr< RelogoLink > repast::relogo::Turtle::linkWith | ( | Turtle * | turtle, |
const std::string & | name = DEFAULT_UNDIR_NET |
||
) |
Gets the link between this turtle and the specified on in the named undirected network.
The network defaults to the default undirected network.
void repast::relogo::Turtle::lt | ( | float | degrees | ) |
Turns the turtle left by the specified number of degrees.
To turn right, use a negative number.
degrees | the amount to turn |
void repast::relogo::Turtle::move | ( | double | distance | ) |
Moves this turtle the specified distance along the current heading.
distance | the distance to move |
void repast::relogo::Turtle::moveTo | ( | Patch * | patch | ) |
Moves this turtle to the location of the specified patch.
patch | the patch whose location this turtle will be moved to |
void repast::relogo::Turtle::moveTo | ( | Turtle * | turtle | ) |
Moves this turtle to the location of the specified turtle.
turtle | the turtle whose location this turtle will be moved to |
|
inline |
Moves this turtle the specified distance along the current heading.
distance | the distance to move |
bool repast::relogo::Turtle::outLinkNeighborQ | ( | Turtle * | turtle, |
const std::string & | name = DEFAULT_DIR_NET |
||
) |
Gets whether or not there is an edge from this turtle to the specified turtle, in the specified network.
The network defaults to the default directed network.
turtle | the turtle to check as the target of the edge |
name | the name of the network to check, defaults to the default directed network. |
void repast::relogo::Turtle::outLinkNeighbors | ( | AgentSet< AgentType > & | out, |
const std::string & | name = DEFAULT_DIR_NET |
||
) |
Gets all the network successors of this turtle in the named network and puts them in the specified array list.
out | the AgentSet to the return the neighbors in |
name | the name of the network to get the network neighbors from |
AgentType | the type of agents to find in the network |
boost::shared_ptr< RelogoLink > repast::relogo::Turtle::outLinkTo | ( | Turtle * | turtle, |
const std::string & | name = DEFAULT_DIR_NET |
||
) |
Gets the link from the this turtle to the specified turtle in the specified network which defaults to the default directed network.
turtle | the turtle to get the link to |
name | the name of the network containing the link |
PatchType * repast::relogo::Turtle::patchHere |
Gets the patch under this turtle.
the | type of the Patch |
PatchType * repast::relogo::Turtle::patchLeftAndAhead | ( | float | angleInDegrees, |
double | distance | ||
) |
Gets the patch that is the specified distance from this turtle, at the specified angle (turning left) from this turtle's heading.
Returns 0 if the patch would be outside of the world.
angleInDegrees | the angle |
distance | the distance |
PatchType | the type of the Patch |
PatchType * repast::relogo::Turtle::patchRightAndAhead | ( | float | angleInDegrees, |
double | distance | ||
) |
Gets the patch that is the specified distance from this turtle, in the specified degrees (turning right) from this turtle's heading.
Returns 0 if the patch would be outside of the world.
angleInDegrees | the angle |
distance | the distance |
PatchType | the type of the Patch |
|
virtual |
Gets the Patch x coordinate of this Turtle.
Implements repast::relogo::AbstractRelogoAgent.
|
virtual |
Gets the Patch x coordinate of this Turtle.
Implements repast::relogo::AbstractRelogoAgent.
void repast::relogo::Turtle::setxy | ( | double | x, |
double | y | ||
) |
Sets the x and y coordinate of the Turtle's location.
If the location is outside of the world bounds this will throw an exception.
x | the x coordinate |
y | the y coordinate |
float repast::relogo::Turtle::towards | ( | const Point< double > & | location | ) | const |
Gets the heading from this turtle to the specified location.
location | the location to get the heading to |
float repast::relogo::Turtle::towards | ( | RelogoAgent * | agent | ) | const |
Gets the heading from this turtle to the specified RelogoAgent (turtle or patch).
float repast::relogo::Turtle::towardsxy | ( | double | x, |
double | y | ||
) | const |
Gets the heading from this turtle to the specified location.
x | the x coordinate of the location |
y | the y coordinate of the location |
void repast::relogo::Turtle::uphill | ( | ValueGetter & | getter | ) |
Moves this turtle to the patch with highest value as retrieved via the ValueGetter.
The 8 neighboring patches and the current patch the turtle is on are considered. If no surrounding patch has a higher value than the patch the turtle is on, this turtle stays on the current patch. If there is more than on patch with the minimum value, then one will be chosen at random.
Note that this turtle will end up in the center of one of the surrounding patches or in the center of its current patch.
getter | the function or functor used to retrieve the value from the patch |
PatchType | the patch's type |
a | functor or function with the following signature double (PatchType* patch) const |
void repast::relogo::Turtle::uphill4 | ( | ValueGetter & | getter | ) |
Moves this turtle to the patch with highest value as retrieved via the ValueGetter.
The 4 neighboring patches and the current patch the turtle is on are considered. If no surrounding patch has a higher value than the patch the turtle is on, this turtle stays on the current patch. If there is more than on patch with the minimum value, then one will be chosen at random. This considers only the current patch and the 4 surrounding patches (N, S, E, W).
Note that this turtle will end up in the center of one of the surrounding patches or in the center of its current patch.
getter | the function or functor used to retrieve the value from the patch |
PatchType | the patch's type |
a | functor or function with the following signature double (PatchType* patch) const |
double repast::relogo::RelogoAgent::xCor |
Gets the x coordinate of the agent's location.
void repast::relogo::Turtle::xCor | ( | double | x | ) |
Sets the x coordinate of the Turtle's location.
If the location is outside of the world bounds this will throw an exception.
x | the new coordinate |
double repast::relogo::RelogoAgent::yCor |
Gets the y coordinate of the agent's location.
void repast::relogo::Turtle::yCor | ( | double | y | ) |
Sets the y coordinate of the Turtle's location.
If the location is outside of the world bounds this will throw an exception.
y | the new y coordinate |