Namespace walle
Classes
Type | Name |
---|---|
class | AStarAgent |
struct | AStarAgentData |
class | AgentFactory |
class | Alerter |
struct | BaseAgentData |
struct | CompareNodes Custom comparison function for priority queue. |
struct | Node Node class to hold information about positions for A* search. |
struct | PacingAgentData |
class | PathAgent |
struct | PathAgentData |
class | RandomAgent |
class | TrackingAgent |
struct | TrackingAgentData |
Public Types
Type | Name |
---|---|
enum | TrackingState |
Public Functions
Type | Name |
---|---|
T & | DownCastAgent (cse491::Entity & entity) Helper function for simplifying downcasting entities that have been added to the world. |
std::vector< cse491::GridPosition > | GetShortestPath (const cse491::GridPosition & start, const cse491::GridPosition & end, const cse491::WorldBase & world, const cse491::AgentBase & agent) Uses A* to return a list of grid positions. |
std::vector< cse491::GridPosition > | StrToOffsets (std::string_view commands) |
Public Types Documentation
enum TrackingState
enum walle::TrackingState {
RETURNING_TO_START,
TRACKING,
PATROLLING
};
Used to keep track of what action we are currently taking
Public Functions Documentation
function DownCastAgent
template<typename T typename T>
T & walle::DownCastAgent (
cse491::Entity & entity
)
function GetShortestPath
Uses A* to return a list of grid positions.
inline std::vector< cse491::GridPosition > walle::GetShortestPath (
const cse491::GridPosition & start,
const cse491::GridPosition & end,
const cse491::WorldBase & world,
const cse491::AgentBase & agent
)
Author:
@mdkdoc15
Parameters:
start
Starting position for searchend
Ending position for the search
Returns:
vector of A* path from start to end, empty vector if no path exists
function StrToOffsets
inline std::vector< cse491::GridPosition > walle::StrToOffsets (
std::string_view commands
)
Converts a string to a sequence of offsets
This convenience method takes a string with a special formatting that allows one to specify a sequence of whitespace-separated inputs in linear directions. The format is [steps[*]]<direction> where steps
is a positive integer and optional (assumed to be 1 by default) star *
represents scaling the movement by steps
. Optional, but cannot be used if steps
is not provided if the star is not present, then steps
individual offsets are created in the direction direction
direction
is a cardinal direction with the following logical mapping: n: north s: south e: east w: west x: stay put Example: "n w 3e 10*s 5*w x" should create the sequence of offsets {0, -1}, {-1, 0}, {1, 0}, {1, 0}, {1, 0}, {0, 10}, {-5, 0}, {0, 0}
Parameters:
commands
string in a format of sequential directions
Note:
throws an std::invalid_argument
when input string is poorly formatted
Note:
this includes when a negative integer is passed as steps
. If a zero is used, treated as the default (one)
The documentation for this class was generated from the following file source/Agents/AgentFactory.hpp