aboutsummaryrefslogtreecommitdiff
path: root/src/board.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/board.cpp')
-rw-r--r--src/board.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/board.cpp b/src/board.cpp
index 0698571..e058df4 100644
--- a/src/board.cpp
+++ b/src/board.cpp
@@ -1,5 +1,6 @@
#include "board.hpp"
#include "bot.hpp"
+#include "zobrist.hpp"
#include <cassert>
#include <cstdio>
#include <iostream>
@@ -143,6 +144,14 @@ void PlayMove(Move move, Game *b) {
}
b->pieces[PositionToIndex(move.To)] = piece;
b->pieces[PositionToIndex(move.From)] = {false, NONE, false};
+
b->turn = !b->turn;
+
+ uint64_t key = GenerateZobristKey(b);
+
+ b->ThreeFoldMap[key]++;
+ if (b->ThreeFoldMap[key] >= 3) {
+ b->state = DRAW;
+ }
};
int PositionToIndex(Position i) { return i.rank * 8 + i.file; }