- for (let s of ChessRules.steps[V.BISHOP]) {
- if (this.insidePalace(x + s[0], y + s[1], c)) steps.push(s);
+ if (
+ y != 4 ||
+ (c == 'w' && x != V.size.x - 2) ||
+ (c == 'b' && x != 1)
+ ) {
+ // In a corner: only one step available
+ let step = null;
+ const direction = (c == 'w' ? -1 : 1);
+ if ((c == 'w' && x == V.size.x - 1) || (c == 'b' && x == 0)) {
+ // On first line
+ if (y == 3) step = [direction, 1];
+ else step = [direction, -1];
+ }
+ else {
+ // On third line
+ if (y == 3) step = [-direction, 1];
+ else step = [-direction, -1];
+ }
+ return super.getSlideNJumpMoves([x, y], [step], 1);