#include <Map.h>
bool Map::arriveDestination |
( |
| ) |
|
Check if has reached the destination.
- Returns
- true - reached
-
false - otherwise
int Map::compareCurrent2nextDirection |
( |
char |
axis | ) |
|
compare current direction with next direction
- Parameters
-
axis | a char symbol for the compare axis, 'x' or 'y' |
- Returns
- 0 - equal
-
1 - current > next
-
-1 - current < next
bool Map::dfs |
( |
point |
cur, |
|
|
int |
step |
|
) |
| |
|
private |
Find a path to the destination via dfs.
- Parameters
-
cur | a point of where the car is now |
step | how many steps has the car searched |
- Returns
- true - can find such a path
-
false - otherwise
- Precondition
- call function initDfs()
bool Map::dfsPointValid |
( |
const point & |
p | ) |
|
|
private |
Judge a point if it is in the map, never visited and reachable.
- Parameters
-
- Returns
- true - in the map, never visited and reachable
-
false - otherwise
getter function of currentDirection
- Returns
- currentDirection
point Map::getCurrentPosition |
( |
| ) |
|
getter function of currentPosition
- Returns
- currentPosition
int Map::getMapAtPosition |
( |
const int & |
position | ) |
|
getter function of the status of a specfic position in the map
- Parameters
-
position | an int wich means the position you want formatted like 74 |
- Returns
- the status of the point
point Map::getNextPosition |
( |
| ) |
|
getter function of nextPosition
- Returns
- nextPosition
void Map::initCurrentAndNextPosition |
( |
| ) |
|
|
private |
initial the current position according to your idea
initial the next position same as current position
void Map::initCurrentDirection |
( |
| ) |
|
|
private |
initial the current direction according to your idea
void Map::initDestination |
( |
| ) |
|
|
private |
initial the distination according to your idea
initial the dfs parameters for function dfs()
initial the Map parameters
initial the map according to your idea
bool Map::nextPositionAvilable |
( |
| ) |
|
check for the nextPosition if it is avialable
- Returns
- true - reachable
-
false - unreachable
Print the map in a specific format.
void Map::printPath |
( |
int |
length | ) |
|
|
private |
Print the path to destination in the specific format.
- Parameters
-
length | the length of the path |
void Map::printPosition |
( |
int |
index | ) |
|
Print three position in the specific format.
- Parameters
-
index | an int symbol 1 - Current Position 2 - Next Position 3 - Destination |
void Map::setCurrentDirection |
( |
direction |
_currentDirection | ) |
|
setter function of currentDirection
- Parameters
-
_currentDirection | a new currentDirection |
void Map::setCurrentPosition |
( |
const point & |
p | ) |
|
setter function of currentPosition
- Parameters
-
void Map::setMapAtPosition |
( |
const point & |
p, |
|
|
const int & |
value |
|
) |
| |
setter function of a position in the map
- Parameters
-
p | the position which you want to set |
value | the status of the position which you want to set |
void Map::updateNextPosition |
( |
| ) |
|
try to search for the path to the destination
If serach successfully, update the nextPosition, else set the nextPosition unreachable
point Map::currentPosition |
|
private |
The documentation for this class was generated from the following files: