summaryrefslogtreecommitdiff
path: root/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'board.h')
-rw-r--r--board.h9
1 files changed, 4 insertions, 5 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);
};