X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fbase_rules.js;h=4c90f1d87b864fec1a747687a00d949941855e34;hb=2a0672a98b555f0fecfd951d583e69419769d411;hp=e9ea7bc10e189f285100e5337b786f6b07805611;hpb=9d15c433c207a2c3bb548d095939c3e08b4038fd;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index e9ea7bc1..4c90f1d8 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -533,7 +533,6 @@ export const ChessRules = class ChessRules { // Squares of white and black king: this.kingPos = { w: [-1, -1], b: [-1, -1] }; const fenRows = V.ParseFen(fen).position.split("/"); - const startRow = { 'w': V.size.x - 1, 'b': 0 }; for (let i = 0; i < fenRows.length; i++) { let k = 0; //column index on board for (let j = 0; j < fenRows[i].length; j++) { @@ -663,7 +662,7 @@ export const ChessRules = class ChessRules { case V.QUEEN: return this.getPotentialQueenMoves(sq); case V.KING: return this.getPotentialKingMoves(sq); } - return []; //never reached + return []; //never reached (but some variants may use it: Bario...) } // Build a regular move from its initial and destination squares. @@ -714,7 +713,7 @@ export const ChessRules = class ChessRules { let j = y + step[1]; while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { moves.push(this.getBasicMove([x, y], [i, j])); - if (oneStep) continue outerLoop; + if (!!oneStep) continue outerLoop; i += step[0]; j += step[1]; } @@ -1073,8 +1072,7 @@ export const ChessRules = class ChessRules { V.OnBoard(rx, ry) && this.board[rx][ry] != V.EMPTY && this.getPiece(rx, ry) == piece && - this.getColor(rx, ry) == color && - this.canTake([rx, ry], [x, y]) //for Paco-Sako (TODO: necessary?) + this.getColor(rx, ry) == color ) { return true; }