RepastHPC  2.3.1
Public Member Functions | List of all members
repast::relogo::Turtle Class Reference

Relogo Turtle implementation. More...

#include <Turtle.h>

Inheritance diagram for repast::relogo::Turtle:
repast::relogo::AbstractRelogoAgent repast::relogo::RelogoAgent repast::Agent

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< RelogoLinkinLinkFrom (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< RelogoLinkoutLinkTo (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< RelogoLinklinkWith (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::AgentIdgetId ()
 Gets the id of this RelogoAgent. More...
 
virtual const repast::AgentIdgetId () 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
 

Detailed Description

Relogo Turtle implementation.

Member Function Documentation

◆ backward()

void repast::relogo::Turtle::backward ( double  distance)
inline

Moves this turtle backward the specified distance.

Parameters
distancethe distance to move

◆ bk()

void repast::relogo::Turtle::bk ( double  distance)
inline

Moves this turtle backward the specified distance.

Parameters
distancethe distance to move

◆ canMoveQ()

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.

Returns
true if this turtle can move the specified distance along its current heading given the current topology, otherwise false

◆ createLinkFrom()

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.

Parameters
turtlethe turtle that will be the source turtle of the lin
networkthe name of the network

◆ createLinkFromLC()

template<typename LinkCreator >
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.

Parameters
turtlethe turtle that will be the source turtle of the link
networkthe name of the network
linkCreatoran object used to create the link
Template Parameters
LinkCreatoran function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target)

◆ createLinksFrom()

template<typename AgentType >
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.

Parameters
agentsthe agentset of agents to create links from
networkthe name of the network to create the links in. This defaults to the default directed network
Template Parameters
AgentTypethe type of object contained by the agentset.

◆ createLinksFromLC()

template<typename AgentType , typename LinkCreator >
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.

Parameters
agentsthe agentset of agents to create links from
networkthe name of the network to create the links in. This defaults to the default directed network
Template Parameters
AgentTypethe type of object contained by the agentset
LinkCreatoran function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target)

◆ createLinksTo()

template<typename AgentType >
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.

Parameters
agentsthe agentset of agents to create links to
networkthe name of the network to create the links in. This defaults to the default directed network
Template Parameters
AgentTypethe type of object contained by the agentset.

◆ createLinksToLC()

template<typename AgentType , typename LinkCreator >
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.

Parameters
agentsthe agentset of agents to create links to
networkthe name of the network to create the links in. This defaults to the default directed network
Template Parameters
AgentTypethe type of object contained by the agentset
LinkCreatoran function or functor with the following signature boost::shared_ptr<RelogoLink> (Turtle* source, Turtle* target)

◆ createLinksWith()

template<typename AgentType >
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.

Parameters
agentsthe agentset of agents to create links with
networkthe name of the network to create the links in. This defaults to the default undirected network
Template Parameters
Agentthe type of object contained by the agentset.

◆ createLinksWithLC()

template<typename AgentType , typename LinkCreator >
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.

Parameters
agentsthe agentset of agents to create links with
networkthe name of the network to create the links in. This defaults to the default undirected network
creatorthe functor to create the links with
Template Parameters
Agentthe type of object contained by the agentset
LinkCreatorthe object used to create the links
LinkCreatoran function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target)

◆ createLinkTo()

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.

Parameters
turtlethe turtle that will be the target turtle of the link
networkthe name of the network

◆ createLinkToLC()

template<typename LinkCreator >
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.

Parameters
turtlethe turtle that will be the target turtle of the link
networkthe name of the network
linkCreatoran object used to create the link
Template Parameters
LinkCreatoran function or functor with the following signature boost::shared_ptr<RelogoLink> (Turtle* source, Turtle* target)

◆ createLinkWith()

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.

Parameters
turtlethe turtle to create the link with
networkthe network to create the link in

◆ createLinkWithLC()

template<typename LinkCreator >
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.

Parameters
turtlethe turtle to create the link with
creatorthe functor to create the link with
networkthe network to create the link in
Template Parameters
LinkCreatoran function or functor with the following signature RelogoLink* (Turtle* source, Turtle* target)

◆ die()

void repast::relogo::Turtle::die ( )

Removes this turtle from the world.

Do not call this if there is a chance the Turtle will be referred to after the call to die()- for example, if it has moved and will be part of a move synchronization.

◆ distance()

double repast::relogo::Turtle::distance ( Turtle turtle) const

Gets the distance from this turtle to the specified turtle.

Parameters
turtlethe turtle to get the distance to
Returns
the distance from this turtle to the specified turtle.

◆ downhill()

template<typename PatchType , typename ValueGetter >
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.

Parameters
getterthe function or functor used to retrieve the value from the patch
Template Parameters
PatchTypethe patch's type
afunctor or function with the following signature double (PatchType* patch) const

◆ downhill4()

template<typename PatchType , typename ValueGetter >
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.

Parameters
getterthe function or functor used to retrieve the value from the patch
Template Parameters
PatchTypethe patch's type
afunctor or function with the following signature double (PatchType* patch) const

◆ dx()

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.

Returns
the distance traveled along the x dimension if the turtle were to take one step forward along its current heading.

◆ dy()

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.

Returns
the distance traveled along the y dimension if the turtle were to take one step forward along its current heading.

◆ face() [1/2]

void repast::relogo::Turtle::face ( Patch patch)

Sets the turtles heading to face towards the specified pach.

Parameters
patchthe patch to face

◆ face() [2/2]

void repast::relogo::Turtle::face ( Turtle turtle)

Sets the turtles heading to face towards the specified turtle.

Parameters
turtlethe turtle to face

◆ facexy()

void repast::relogo::Turtle::facexy ( double  nx,
double  ny 
)

Sets the turtles heading to face the specified coordinates.

Parameters
nxthe x coordinate of the location to face
nythe y coordinate of the location to face

◆ fd()

void repast::relogo::Turtle::fd ( double  distance)
inline

Moves this turtle forward the specified distance.

Parameters
distancethe distance to move

◆ forward()

void repast::relogo::Turtle::forward ( double  distance)
inline

Moves this turtle forward the specified distance.

Parameters
distancethe distance to move

◆ heading() [1/2]

float repast::relogo::Turtle::heading ( ) const
inline

Gets this Turtle's current heading.

Returns
this Turtle's current heading.

◆ heading() [2/2]

void repast::relogo::Turtle::heading ( float  heading)

Sets this turtle's heading to the specified heading.

Parameters
headingthe new heading

◆ inLinkFrom()

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.

Parameters
turtlethe turtle to get the link from
namethe name of the network containing the link
Returns
the link from the specified turtle to this one in the specified network which defaults to the default directed network.

◆ inLinkNeighborQ()

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.

Parameters
turtlethe turtle to check as the source of the edge
namethe name of the network to check, defaults to the default directed network.
Returns
true if there is an edge into this turtle from the specified turtle in the named directed network, otherwise false.

◆ inLinkNeighbors()

template<typename AgentType >
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.

Parameters
outthe AgentSet to the return the neighbors in
namethe name of the network to get the network neighbors from
Template Parameters
AgentTypethe type of agents to find in the network

◆ jump()

void repast::relogo::Turtle::jump ( double  distance)
inline

Moves this turtle forward the specified distance, if and only if that would not take this turtle outside the current topology.

Parameters
distancethe amount to move

◆ left()

void repast::relogo::Turtle::left ( float  degrees)

Turns the turtle left by the specified number of degrees.

To turn right, use a negative number.

Parameters
degreesthe amount to turn

◆ linkNeighborQ()

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.

Parameters
turtlethe turtle to check that this links to
namethe name of the network to check, defaults to the default undirected network.
Returns
true if this this turtle is linked to the specified turtle in the named undirected network, otherwise false.

◆ linkNeighbors()

template<typename AgentType >
void repast::relogo::Turtle::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.

Parameters
outthe AgentSet to the return the neighbors in
namethe name of the network to get the network neighbors from
Template Parameters
AgentTypethe type of agents to find in the network

◆ linkWith()

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.

Returns
the link between this turtle and the specified on in the named undirected network.

◆ lt()

void repast::relogo::Turtle::lt ( float  degrees)

Turns the turtle left by the specified number of degrees.

To turn right, use a negative number.

Parameters
degreesthe amount to turn

◆ move()

void repast::relogo::Turtle::move ( double  distance)

Moves this turtle the specified distance along the current heading.

Parameters
distancethe distance to move

◆ moveTo() [1/2]

void repast::relogo::Turtle::moveTo ( Patch patch)

Moves this turtle to the location of the specified patch.

Parameters
patchthe patch whose location this turtle will be moved to

◆ moveTo() [2/2]

void repast::relogo::Turtle::moveTo ( Turtle turtle)

Moves this turtle to the location of the specified turtle.

Parameters
turtlethe turtle whose location this turtle will be moved to

◆ mv()

void repast::relogo::Turtle::mv ( double  distance)
inline

Moves this turtle the specified distance along the current heading.

Parameters
distancethe distance to move

◆ outLinkNeighborQ()

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.

Parameters
turtlethe turtle to check as the target of the edge
namethe name of the network to check, defaults to the default directed network.
Returns
true if there is an edge from this turtle into the specified turtle in the named directed network, otherwise false.

◆ outLinkNeighbors()

template<typename AgentType >
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.

Parameters
outthe AgentSet to the return the neighbors in
namethe name of the network to get the network neighbors from
Template Parameters
AgentTypethe type of agents to find in the network

◆ outLinkTo()

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.

Parameters
turtlethe turtle to get the link to
namethe name of the network containing the link
Returns
the link from the this turtle to the specified turtle in the specified network which defaults to the default directed network.

◆ patchHere()

template<typename PatchType >
PatchType * repast::relogo::Turtle::patchHere

Gets the patch under this turtle.

Template Parameters
thetype of the Patch

◆ patchLeftAndAhead()

template<typename PatchType >
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.

Parameters
angleInDegreesthe angle
distancethe distance
Template Parameters
PatchTypethe type of the Patch
Returns
the patch that is the specified distance from this turtle, at the specified angle (turning left) from this turtle's heading or 0 if the patch would be outside of the world.

◆ patchRightAndAhead()

template<typename PatchType >
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.

Parameters
angleInDegreesthe angle
distancethe distance
Template Parameters
PatchTypethe type of the Patch
Returns
the patch that is the specified distance from this turtle, at the specified angle (turning right) from this turtle's heading or 0 if the patch would be outside of the world.

◆ pxCor()

int repast::relogo::Turtle::pxCor ( ) const
virtual

Gets the Patch x coordinate of this Turtle.

Returns
the patch x coordinate of this Turtle.

Implements repast::relogo::AbstractRelogoAgent.

◆ pyCor()

int repast::relogo::Turtle::pyCor ( ) const
virtual

Gets the Patch x coordinate of this Turtle.

Returns
the patch x coordinate of this Turtle.

Implements repast::relogo::AbstractRelogoAgent.

◆ setxy()

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.

Parameters
xthe x coordinate
ythe y coordinate

◆ towards() [1/2]

float repast::relogo::Turtle::towards ( const Point< double > &  location) const

Gets the heading from this turtle to the specified location.

Parameters
locationthe location to get the heading to
Returns
the heading from this turtle to the specified location.

◆ towards() [2/2]

float repast::relogo::Turtle::towards ( RelogoAgent agent) const

Gets the heading from this turtle to the specified RelogoAgent (turtle or patch).

Parameters
agentthe Turtle or Patch this will get the heading to
Returns
the heading from this turtle to the specified RelogoAgent (turtle or patch).

◆ towardsxy()

float repast::relogo::Turtle::towardsxy ( double  x,
double  y 
) const

Gets the heading from this turtle to the specified location.

Parameters
xthe x coordinate of the location
ythe y coordinate of the location
Returns
the heading from this turtle to the specified location.

◆ uphill()

template<typename PatchType , typename ValueGetter >
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.

Parameters
getterthe function or functor used to retrieve the value from the patch
Template Parameters
PatchTypethe patch's type
afunctor or function with the following signature double (PatchType* patch) const

◆ uphill4()

template<typename PatchType , typename ValueGetter >
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.

Parameters
getterthe function or functor used to retrieve the value from the patch
Template Parameters
PatchTypethe patch's type
afunctor or function with the following signature double (PatchType* patch) const

◆ xCor() [1/2]

double repast::relogo::RelogoAgent::xCor

Gets the x coordinate of the agent's location.

Returns
the x coordinate of the agent's location.

◆ xCor() [2/2]

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.

Parameters
xthe new coordinate

◆ yCor() [1/2]

double repast::relogo::RelogoAgent::yCor

Gets the y coordinate of the agent's location.

Returns
the y coordinate of the agent's location.

◆ yCor() [2/2]

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.

Parameters
ythe new y coordinate

The documentation for this class was generated from the following files: