#include <robot_api.hpp>
Static Public Member Functions | |
static GridCell * | findNearestAlly (GridCell &origin, std::vector< std::vector< GridCell > > &grid) |
static std::list< GridCell * > | findShortestPath (GridCell &origin, const GridCell &target, std::vector< std::vector< GridCell > > &grid) |
Static Private Member Functions | |
static std::list< GridCell * > | findShortestPathInternal (GridCell &origin, const std::function< bool(const GridCell &)> &isTarget, const std::function< bool(const GridCell &)> &isPassable, std::vector< std::vector< GridCell > > &grid) |
RobotUtility class
Provides utilities for students to use in Robot implementations.
Definition at line 146 of file robot_api.hpp.
|
static |
Find nearest neighbor:
Finds the nearest ally to cell, approximately as the crow flies.
origin | cell to find |
grid | grid to analyze |
Definition at line 19 of file robot_api.cpp.
References findShortestPathInternal().
Referenced by RoboSim::RoboAPIImplementor::sendMessage().
|
static |
Shortest path calculator:
Finds the shortest path from one grid cell to another.
This uses Dijkstra's algorithm to attempt to find the shortest path from one grid cell to another. Cells are adjacent if they are up, down, left, or right of each other. Cells are not adjacent if they are diagonal to one another.
origin | starting grid cell |
target | ending grid cell |
grid | grid to analyze |
Definition at line 29 of file robot_api.cpp.
References robot_api::GridCell::contents, robot_api::EMPTY, and findShortestPathInternal().
Referenced by RoboSim::RoboAPIImplementor::capsuleAttack(), RoboSim::RoboAPIImplementor::rangedAttack(), and DemoBot::searchAndDestroy().
|
staticprivate |
Definition at line 50 of file robot_api.cpp.
References a::x, robot_api::GridCell::x_coord, and robot_api::GridCell::y_coord.
Referenced by findNearestAlly(), and findShortestPath().