diff options
-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; |