pacman/lib/include/PacManAI.hpp

36 lines
870 B
C++
Raw Normal View History

#pragma once
#include "Blinky.hpp"
#include "Direction.hpp"
#include "Inky.hpp"
#include "PacMan.hpp"
#include "Pellets.hpp"
#include "Pinky.hpp"
#include "Position.hpp"
#include "SuperPellets.hpp"
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);
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();
private:
Position pos;
2021-09-22 12:15:33 +00:00
Direction direction = Direction::RIGHT;
};
} // namespace pacman