summaryrefslogtreecommitdiff
path: root/board.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2018-03-12 12:26:10 +0100
committertomsmeding <tom.smeding@gmail.com>2018-03-12 12:26:10 +0100
commit485228f8e01fef40a79cff4c5631388188675df6 (patch)
tree8a130dff2082f92c2e389eff358138f2e4de7fd1 /board.h
parent0369c84bcaea4a1e3c7e41be4ece2c815ab487e3 (diff)
Check mate
Diffstat (limited to 'board.h')
-rw-r--r--board.h8
1 files changed, 8 insertions, 0 deletions
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);
};