Use upper case PacMan when noun
This commit is contained in:
parent
9934add502
commit
172f3d8c60
2 changed files with 5 additions and 5 deletions
|
@ -7,10 +7,10 @@ Let's implement a naive AI for PacMan.
|
||||||
## Background: PacMan Moves
|
## Background: PacMan Moves
|
||||||
|
|
||||||
At each intersection, check if there is a ghost directly inline with that path. If the path is free of ghosts, you are
|
At each intersection, check if there is a ghost directly inline with that path. If the path is free of ghosts, you are
|
||||||
allowed to turn there. And if PacMan is moving in a direction, and a ghost enters his path, then pacman will reverse.
|
allowed to turn there. And if PacMan is moving in a direction, and a ghost enters his path, then PacMan will reverse.
|
||||||
|
|
||||||
For example if pacman is at an intersection and can go either right or up, and there is a ghost in the path going right,
|
For example if PacMan is at an intersection and can go either right or up, and there is a ghost in the path going right,
|
||||||
then pacman will go up. Then while pacman is going up, a ghost enters that path, pacman will go back.
|
then PacMan will go up. Then while PacMan is going up, a ghost enters that path, PacMan will go back.
|
||||||
|
|
||||||
You only need to worry about the grid itself and any ghosts on the North/South/East/West axis of PacMan.
|
You only need to worry about the grid itself and any ghosts on the North/South/East/West axis of PacMan.
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ You only need to worry about the grid itself and any ghosts on the North/South/E
|
||||||
### Part 1
|
### Part 1
|
||||||
|
|
||||||
Implement [PacManAI::pelletClosestToPacman](../../../lib/PacManAI.cpp) and test your implementation with the test
|
Implement [PacManAI::pelletClosestToPacman](../../../lib/PacManAI.cpp) and test your implementation with the test
|
||||||
in [testPacmanAI.cpp](../../../test/testPacmanAI.cpp) called _"Find pellet closest to pacman"_
|
in [testPacmanAI.cpp](../../../test/testPacmanAI.cpp) called _"Find pellet closest to PacMan"_
|
||||||
|
|
||||||
The function should return the position of the pellet that is "closest" to PacMan. One implementation could be to sort
|
The function should return the position of the pellet that is "closest" to PacMan. One implementation could be to sort
|
||||||
the vector of pellets by the distance they have to PacMan, and then return the first one.
|
the vector of pellets by the distance they have to PacMan, and then return the first one.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <PacManAI.hpp>
|
#include <PacManAI.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
TEST_CASE("Find pellet closest to pacman", "[AI]") {
|
TEST_CASE("Find pellet closest to PacMan", "[AI]") {
|
||||||
using namespace pacman;
|
using namespace pacman;
|
||||||
PacManAI AI;
|
PacManAI AI;
|
||||||
using TestData = std::tuple<GridPosition, std::vector<GridPosition>, GridPosition>;
|
using TestData = std::tuple<GridPosition, std::vector<GridPosition>, GridPosition>;
|
||||||
|
|
Loading…
Reference in a new issue