summaryrefslogtreecommitdiff
path: root/board.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'board.cpp')
-rw-r--r--board.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/board.cpp b/board.cpp
index 69a7094..5425d7b 100644
--- a/board.cpp
+++ b/board.cpp
@@ -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;