2021-06-10 12:42:51 +00:00
|
|
|
#pragma once
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-06-20 16:52:34 +00:00
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
2020-11-28 13:10:25 +00:00
|
|
|
#include "Direction.hpp"
|
|
|
|
#include "Position.hpp"
|
2021-07-01 12:33:59 +00:00
|
|
|
#include <array>
|
2020-11-27 13:10:09 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
|
|
|
|
2021-07-01 12:33:59 +00:00
|
|
|
const std::size_t ROWS = 31;
|
|
|
|
const std::size_t COLUMNS = 28;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
|
|
|
class Board {
|
|
|
|
public:
|
2021-06-24 11:32:52 +00:00
|
|
|
enum class Cell {
|
|
|
|
wall = 0,
|
|
|
|
pellet = 1,
|
|
|
|
nothing = 2,
|
|
|
|
door = 3,
|
|
|
|
power_pellet = 4,
|
2021-06-25 09:06:50 +00:00
|
|
|
pen = 5,
|
2021-06-24 11:32:52 +00:00
|
|
|
};
|
|
|
|
|
2021-07-05 09:40:10 +00:00
|
|
|
[[nodiscard]] static bool isWalkableForPacMan(Position point, double d, Direction direction) ;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-07-01 12:33:59 +00:00
|
|
|
[[nodiscard]] static bool isWalkableForGost(Position point, Position origin, bool isEyes) ;
|
|
|
|
[[nodiscard]] static bool isWalkable(Position point) ;
|
|
|
|
[[nodiscard]] static bool isInPen(Position point) ;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-07-05 09:46:49 +00:00
|
|
|
[[nodiscard]] static std::vector<GridPosition> initialPelletPositions() ;
|
2021-06-25 09:06:50 +00:00
|
|
|
|
2021-07-05 09:46:49 +00:00
|
|
|
[[nodiscard]] static std::vector<GridPosition> initialSuperPelletPositions() ;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-06-24 11:32:52 +00:00
|
|
|
static Position initialPacManPosition() { return { 13.5, 23 }; }
|
|
|
|
|
|
|
|
static Position initialBlinkyPosition() { return { 13.5, 11 }; }
|
2021-06-25 09:06:50 +00:00
|
|
|
static Position penDoorPosition() { return { 13, 11 }; }
|
|
|
|
|
|
|
|
static Position blinkyScatterTarget() { return { 25, -3 }; }
|
2021-06-24 11:32:52 +00:00
|
|
|
|
|
|
|
static Position initialSpeedyPosition() { return { 11.5, 14 }; }
|
|
|
|
static Position speedyScatterTarget() { return { 3, -2 }; }
|
|
|
|
|
|
|
|
static Position initialInkyPosition() { return { 13.5, 14 }; }
|
|
|
|
static Position inkyScatterTarget() { return { 27, 30 }; }
|
|
|
|
|
|
|
|
static Position initialClydePosition() { return { 15.5, 14 }; }
|
|
|
|
static Position clydeScatterTarget() { return { 0, 30 }; }
|
2020-11-27 13:10:09 +00:00
|
|
|
|
|
|
|
private:
|
2021-07-05 09:40:10 +00:00
|
|
|
[[nodiscard]] static bool isWalkable(Position point, double d, Direction direction, bool pacman) ;
|
2021-07-01 12:33:59 +00:00
|
|
|
static std::array<
|
|
|
|
std::array<int, COLUMNS>,
|
|
|
|
ROWS>
|
|
|
|
board;
|
2020-11-27 13:10:09 +00:00
|
|
|
};
|