diff options
author | tomsmeding <tom.smeding@gmail.com> | 2018-03-12 13:55:19 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2018-03-12 13:55:19 +0100 |
commit | 3de177458e8ca38cdae100f8bf5d6d75bcce0d14 (patch) | |
tree | 473ee8e1ef789f1a80eab7b35c9894ef4768d4b3 | |
parent | dd3d84dc02d7d7fc782fe2734b9ab6fd028b1346 (diff) |
-rw-r--r-- | board.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
@@ -160,33 +160,41 @@ vector<Board> Board::subsequents() const { break; case BISHOP: - for (int i2 = i - 9; i2 >= 0; i2 -= 9) { - if (at(i2) == EMPTY || colour(at(i2)) != clr) { - subs.push_back(newWith(SHIFTER(i, i2))); + if (i % 8 != 0) { + for (int i2 = i - 9; i2 >= 0; i2 -= 9) { + if (at(i2) == EMPTY || colour(at(i2)) != clr) { + subs.push_back(newWith(SHIFTER(i, i2))); + } + if (at(i2) != EMPTY) break; + if (i2 % 8 == 0) break; } - if (at(i2) != EMPTY) break; - if (i2 % 8 == 0) break; } - for (int i2 = i - 7; i2 >= 0; i2 -= 7) { - if (at(i2) == EMPTY || colour(at(i2)) != clr) { - subs.push_back(newWith(SHIFTER(i, i2))); + if (i % 8 != 7) { + for (int i2 = i - 7; i2 >= 0; i2 -= 7) { + if (at(i2) == EMPTY || colour(at(i2)) != clr) { + subs.push_back(newWith(SHIFTER(i, i2))); + } + if (at(i2) != EMPTY) break; + if (i2 % 8 == 7) break; } - if (at(i2) != EMPTY) break; - if (i2 % 8 == 7) break; } - for (int i2 = i + 7; i2 < 64; i2 += 7) { - if (at(i2) == EMPTY || colour(at(i2)) != clr) { - subs.push_back(newWith(SHIFTER(i, i2))); + if (i % 8 != 0) { + for (int i2 = i + 7; i2 < 64; i2 += 7) { + if (at(i2) == EMPTY || colour(at(i2)) != clr) { + subs.push_back(newWith(SHIFTER(i, i2))); + } + if (at(i2) != EMPTY) break; + if (i2 % 8 == 0) break; } - if (at(i2) != EMPTY) break; - if (i2 % 8 == 0) break; } - for (int i2 = i + 9; i2 < 64; i2 += 9) { - if (at(i2) == EMPTY || colour(at(i2)) != clr) { - subs.push_back(newWith(SHIFTER(i, i2))); + if (i % 8 != 7) { + for (int i2 = i + 9; i2 < 64; i2 += 9) { + if (at(i2) == EMPTY || colour(at(i2)) != clr) { + subs.push_back(newWith(SHIFTER(i, i2))); + } + if (at(i2) != EMPTY) break; + if (i2 % 8 == 7) break; } - if (at(i2) != EMPTY) break; - if (i2 % 8 == 7) break; } break; |