X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCopycat.js;h=c7d12a52fb8c474de74bb0e443a595bd3dcfa34b;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=089b92f86b98410014393d0e5602c89814e8962a;hpb=b21e0e3a8f4af5c04b39c034d13bbb4e1e2abf18;p=vchess.git diff --git a/client/src/variants/Copycat.js b/client/src/variants/Copycat.js index 089b92f8..c7d12a52 100644 --- a/client/src/variants/Copycat.js +++ b/client/src/variants/Copycat.js @@ -8,7 +8,6 @@ export class CopycatRules extends ChessRules { const piece = this.getPiece(x,y); if ([V.PAWN, V.KING].includes(piece)) return moves; const color = this.turn; - const oneStep = (piece == V.PAWN); let movements = {}, steps = []; if (piece == V.QUEEN) steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]); @@ -39,8 +38,9 @@ export class CopycatRules extends ChessRules { (piece != V.QUEEN && type != piece) || (piece == V.QUEEN && type == V.KNIGHT) ) { + const nbSteps = (type == V.KNIGHT ? 1 : undefined); Array.prototype.push.apply(moves, - this.getSlideNJumpMoves([x, y], V.steps[type], type == V.KNIGHT)); + super.getSlideNJumpMoves([x, y], V.steps[type], nbSteps)); } }); return moves; @@ -141,4 +141,8 @@ export class CopycatRules extends ChessRules { ); } + static get SEARCH_DEPTH() { + return 2; + } + };