- findCaptures_aux([x,y], asA)
- {
- const color = this.getColor(x,y);
- var moves = [];
- const steps = asA != V.PAWN
- ? (asA==V.QUEEN ? V.steps[V.ROOK].concat(V.steps[V.BISHOP]) : V.steps[asA])
- : color=='w' ? [[-1,-1],[-1,1]] : [[1,-1],[1,1]];
- const oneStep = (asA==V.KNIGHT || asA==V.PAWN); //we don't capture king
- const lastRank = (color == 'w' ? 0 : V.size.x-1);
- const promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN];
- outerLoop:
- for (let loop=0; loop<steps.length; loop++)
- {
+ findCaptures_aux([x, y], asA) {
+ const color = this.getColor(x, y);
+ let moves = [];
+ const steps =
+ asA != V.PAWN
+ ? asA == V.QUEEN
+ ? V.steps[V.ROOK].concat(V.steps[V.BISHOP])
+ : V.steps[asA]
+ : color == "w"
+ ? [
+ [-1, -1],
+ [-1, 1]
+ ]
+ : [
+ [1, -1],
+ [1, 1]
+ ];
+ const oneStep = [V.KNIGHT,V.PAWN].includes(asA); //we don't capture king
+ const lastRank = color == "w" ? 0 : V.size.x - 1;
+ const promotionPieces = [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN];
+ outerLoop: for (let loop = 0; loop < steps.length; loop++) {