diff options
Diffstat (limited to 'board.h')
-rw-r--r-- | board.h | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -2,6 +2,7 @@ #include <iostream> #include <vector> +#include <array> #include <bitset> #include <functional> #include <cstdint> @@ -53,7 +54,7 @@ public: uint8_t putCW(int idx, uint8_t clr); // The callback may modify the board, but must leave it as it was after returning. - void forEachMove(const function<void(int idx)> &f); + const vector<int>& getEdgeCells() const; void write(ostream &os) const; @@ -62,19 +63,20 @@ public: private: // 0 = empty, 1...NC = coloured stones - uint8_t bd[BSZ * BSZ]; + array<uint8_t, BSZ * BSZ> bd; - // Candidates for edge cells; all cells that can take a stone must be - // elements of this list, but there may be more. - vector<int> edgeCands; + // The cells that are neighbour to a stone on the board, i.e. those cells + // that can take a stone in the next move. + vector<int> edgeCells; - // Whether a particular cell is in edgeCands. - bitset<BSZ * BSZ> inEdgeCands; + // Where a particular cell is in edgeCells (or -1 if not present). + array<int, BSZ * BSZ> inEdgeCells; Board() = default; int countStones(uint8_t clr, int idx, int delta) const; void newEdgeCand(int idx); + void removeEdgeCell(int idx); }; struct Stone { |