-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReferee.h
43 lines (35 loc) · 1.23 KB
/
Referee.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "Position.h"
#include "Player.h"
#include <memory>
class Referee
{
public:
Referee() = default;
~Referee() = default;
void setBoard(const std::shared_ptr<Board>& board);
void setPlayers(const std::shared_ptr<std::vector<Player*>> & players);
void launch();
bool Win(const PlayerName&) const;
void illegalMove(const PlayerName&);
bool ValidWall(const WallPosition&) const;
bool ValidPawn(const PawnPosition&) const;
bool ValidMove(const Move&) const;
const std::vector<WallPosition>& getValidWalls(const PlayerName&);
const std::vector<PawnPosition>& getValidPawns(const PlayerName&);
friend std::ostream& operator<<(std::ostream& out, const Referee& referee)
{
out << "Classic";
return out;
}
private:
std::shared_ptr<Board> board_;
std::shared_ptr<std::vector<Player*>> players_;
std::vector<PawnPosition> validPawns_;
std::vector<WallPosition> validwalls_;
std::vector<Move> validMoves_;
PlayerName illegalMove_;
std::vector<WallPosition> findBlockerWalls(const BoardPosition&, const BoardPosition&) const;
bool noBlockerWalls(const BoardPosition&, const BoardPosition&) const;
Player& find(const PlayerName&) const;
};