2021-09-16 14:36:57 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-09-17 14:44:16 +00:00
|
|
|
#include "Blinky.hpp"
|
|
|
|
#include "Direction.hpp"
|
|
|
|
#include "Inky.hpp"
|
|
|
|
#include "PacMan.hpp"
|
|
|
|
#include "Pellets.hpp"
|
|
|
|
#include "Pinky.hpp"
|
|
|
|
#include "Position.hpp"
|
|
|
|
#include "SuperPellets.hpp"
|
|
|
|
|
2021-09-16 14:36:57 +00:00
|
|
|
namespace pacman {
|
|
|
|
|
|
|
|
class PacManAI {
|
|
|
|
public:
|
2021-10-05 09:58:06 +00:00
|
|
|
struct Move {
|
|
|
|
Direction direction = Direction::NONE;
|
|
|
|
GridPosition position;
|
|
|
|
double distanceToTarget = std::numeric_limits<double>::infinity();
|
|
|
|
};
|
|
|
|
|
2021-09-22 12:06:17 +00:00
|
|
|
void update(const PacMan & pacMan, const Pellets & pellets);
|
2021-09-17 14:44:16 +00:00
|
|
|
Direction suggestedDirection() const;
|
2021-10-05 09:58:06 +00:00
|
|
|
GridPosition pelletClosestToPacman(GridPosition pacmanGridPosition,
|
2021-10-05 11:42:56 +00:00
|
|
|
std::vector<GridPosition> & pellets);
|
2021-10-05 09:58:06 +00:00
|
|
|
bool isValidMove(const Move & move);
|
|
|
|
Direction optimalDirection(const std::array<Move, 4> & moves);
|
|
|
|
void reset();
|
2021-09-17 14:44:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Position pos;
|
2021-09-22 12:15:33 +00:00
|
|
|
Direction direction = Direction::RIGHT;
|
2021-09-16 14:36:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pacman
|