summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2018-03-12 12:25:54 +0100
committertomsmeding <tom.smeding@gmail.com>2018-03-12 12:25:54 +0100
commit0369c84bcaea4a1e3c7e41be4ece2c815ab487e3 (patch)
tree70b135bc366165c872235dfc8e55b1b10ef62612
parentf0163d7e905a65c13e2fab35bf3b8fec3c7b726d (diff)
Fixes
-rw-r--r--board.h9
-rw-r--r--main.cpp2
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<evaluate_pieceScore>(subs[i], AB_MAXDEPTH);
if (i != 0) cout << ", ";
- cout << v << endl;
+ cout << v << flush;
v *= multfactor;
if (v > maxval) {
maxval = v;