1 #ifndef _NALCG_MIDDLEMAN_H_
2 #define _NALCG_MIDDLEMAN_H_
8 #include "logic/colour.h"
9 #include "logic/board.h"
10 #include "logic/chesspieces-meta.h"
20 static const unsigned int HALF_TURN
= 1;
21 static const unsigned int FULL_TURN
= 2;
23 Middleman(const std::vector
<AI
*>& aiList
, const std::vector
<AIInfo
>& aiInfos
);
31 std::vector
<std::size_t> getValidMovesAt(std::size_t x
, std::size_t y
) const;
33 unsigned int move( std::size_t fromX
, std::size_t fromY
,
34 std::size_t toX
, std::size_t toY
,
35 unsigned int promoteTo
= 0);
37 void undo(unsigned int steps
= FULL_TURN
);
40 std::size_t getAICount() const { return aiList
.size(); }
42 const AIInfo
& getAIInfoAt(std::size_t index
) const { return aiInfos
.at(index
); }
44 const std::vector
<std::string
>& getGameLog() const { return gameLog
; }
46 const Board
* getGameStateAt(std::size_t index
) const { return gameStates
.at(index
); }
48 // Should be called *after* playRound(), since that updates currentPlayer.
49 unsigned int getGameConditionMask() const;
52 void addView(EndUser
* view
) { views
.push_back(view
); }
59 std::vector
<EndUser
*> views
;
60 std::vector
<AI
*> aiList
;
61 std::vector
<AIInfo
> aiInfos
;
62 std::vector
<Board
*> gameStates
;
63 std::vector
<std::string
> gameLog
;
68 void moveUpdate(std::size_t fromX
, std::size_t fromY
,
69 std::size_t toX
, std::size_t toY
, bool continuous
= false);
71 void promoteUpdate( std::size_t fromX
, std::size_t fromY
,
72 std::size_t toX
, std::size_t toY
,
73 unsigned int promoteTo
);
77 const std::string
newLogEntry( std::size_t fromX
, std::size_t fromY
,
78 std::size_t toX
, std::size_t toY
) const;
81 void deleteAndClear(std::vector
<T
>& vector
);
84 #endif // _NALCG_MIDDLEMAN_H_