From 0369c84bcaea4a1e3c7e41be4ece2c815ab487e3 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 12 Mar 2018 12:25:54 +0100 Subject: Fixes --- board.h | 9 ++++----- main.cpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/board.h b/board.h index a714de0..eb50917 100644 --- a/board.h +++ b/board.h @@ -12,10 +12,10 @@ const int BLACK = 1; const int EMPTY = 0, PAWN = 1, ROOK = 2, KNIGHT = 3, BISHOP = 4, KING = 5, QUEEN = 6; -// WHITE WHITE WHITE y = 0 +// BLACK BLACK BLACK y = 0 // ... // ... -// BLACK BLACK BLACK y = 7 +// WHITE WHITE WHITE y = 7 #define IDX(x_, y_) (8 * (y_) + (x_)) @@ -44,13 +44,12 @@ public: inline int at(int x, int y) const {return at(IDX(x, y));} inline int at(int idx) const {return bd[idx];} - int locate(int stone) const; + int locate(int stone) const; // moderately slow (iterates board) static inline int colour(int stone) {return stone > 0 ? WHITE : BLACK;} static inline int worth(int stone) { static const int w[7] = {0, 1, 5, 3, 3, 100000000, 9}; - if (stone < -6 || stone > 6) __asm("int3\n\t"); return w[abs(stone)]; } @@ -58,7 +57,7 @@ public: void apply(const Move &mv); // does not perform checking - bool isValid(const Move &mv); + bool isValid(const Move &mv) const; // SLOW friend bool operator==(const Board &B1, const Board &B2); }; diff --git a/main.cpp b/main.cpp index 1419b08..6f8a50b 100644 --- a/main.cpp +++ b/main.cpp @@ -57,7 +57,7 @@ int main() { for (size_t i = 0; i < subs.size(); i++) { int v = alphabeta(subs[i], AB_MAXDEPTH); if (i != 0) cout << ", "; - cout << v << endl; + cout << v << flush; v *= multfactor; if (v > maxval) { maxval = v; -- cgit v1.2.3