Push things so Patricia can fix the headers and stuffs
This commit is contained in:
parent
5fa007f267
commit
c9b8277d8f
1 changed files with 28 additions and 10 deletions
|
@ -22,9 +22,6 @@ You only need to worry about the grid itself and any ghosts on the North/South/E
|
|||
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.
|
||||
|
||||
*Hint 1*: use the `positionDistance` function to find the distance to PacMan
|
||||
*Hint 2*: use the [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort) function to sort the vector
|
||||
|
||||
```cpp
|
||||
GridPosition PacManAI::pelletClosestToPacman(GridPosition pacmanGridPosition,
|
||||
std::vector<GridPosition> & pellets) {
|
||||
|
@ -32,24 +29,45 @@ GridPosition PacManAI::pelletClosestToPacman(GridPosition pacmanGridPosition,
|
|||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Hint 1</summary>
|
||||
|
||||
Use the `positionDistance` function to find the distance to PacMan.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary>Hint 2</summary>
|
||||
|
||||
Use the [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort) function to sort the vector.
|
||||
|
||||
</details>
|
||||
|
||||
2. Implement [PacManAI::isValidMove](../../../lib/PacManAI.cpp) and test your implementation with the test
|
||||
in [testPacmanAI.cpp](../../../test/testPacmanAI.cpp) called _"Is valid move"_
|
||||
|
||||
*Hint*:
|
||||
|
||||
|
||||
```cpp
|
||||
bool PacManAI::isValidMove(const Move & move) {
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Hint</summary>
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
3. Implement [PacManAI::optimalDirection](../../../lib/PacManAI.cpp) and test your implementation with the test
|
||||
in [testPacmanAI.cpp](../../../test/testPacmanAI.cpp) called _"Is optimal direction"_
|
||||
|
||||
*Hint*:
|
||||
|
||||
|
||||
```cpp
|
||||
Direction PacManAI::optimalDirection(const std::array<Move, 4> & moves) {
|
||||
return Direction::NONE;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Hint</summary>
|
||||
</details>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue