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"
|
2020-11-27 13:10:09 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
const uint8_t ROWS = 31;
|
|
|
|
const uint8_t COLUMNS = 28;
|
|
|
|
|
|
|
|
class Board {
|
|
|
|
public:
|
|
|
|
Board();
|
|
|
|
|
2021-06-24 09:40:49 +00:00
|
|
|
[[nodiscard]] bool isWalkableForPacMan(Position point, float d, Direction direction) const;
|
|
|
|
[[nodiscard]] bool isWalkableForGhost(Position point, float d, Direction direction) const;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-06-20 16:52:34 +00:00
|
|
|
[[nodiscard]] std::vector<PositionInt> initialPelletPositions() const;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-06-20 16:52:34 +00:00
|
|
|
[[nodiscard]] std::vector<PositionInt> initialSuperPelletPositions() const;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-06-16 10:52:04 +00:00
|
|
|
static Position initialPacManPosition() { return { 14, 23 }; }
|
2020-11-27 13:10:09 +00:00
|
|
|
|
|
|
|
private:
|
2021-06-24 09:40:49 +00:00
|
|
|
[[nodiscard]] bool isWalkable(Position point, float d, Direction direction, bool pacman) const;
|
2020-11-27 16:16:42 +00:00
|
|
|
uint8_t board_state[ROWS][COLUMNS]{};
|
2020-11-27 13:10:09 +00:00
|
|
|
};
|