From 485228f8e01fef40a79cff4c5631388188675df6 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 12 Mar 2018 12:26:10 +0100 Subject: Check mate --- board.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'board.h') diff --git a/board.h b/board.h index eb50917..6b17d53 100644 --- a/board.h +++ b/board.h @@ -17,6 +17,10 @@ const int EMPTY = 0, PAWN = 1, ROOK = 2, KNIGHT = 3, BISHOP = 4, KING = 5, QUEEN // ... // WHITE WHITE WHITE y = 7 +enum class CheckResult { + safe, check, checkmate, stalemate +}; + #define IDX(x_, y_) (8 * (y_) + (x_)) @@ -59,6 +63,10 @@ public: bool isValid(const Move &mv) const; // SLOW + // SLOW; Only detects anything for the given player. + // Assumes no king has been taken yet. + CheckResult checkCheck(int player) const; + friend bool operator==(const Board &B1, const Board &B2); }; -- cgit v1.2.3-70-g09d2