X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=ee5ddd02a2372c28f70ef04ab01edb15c8df7390;hp=48a5602c33c32688762c998d13fd9ab4d54b2261;hb=15952ada1d73262371654351ab8a4471f64010fd;hpb=7364deaad00584ee809b7e941d90a4901619b8b1 diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 48a5602c..ee5ddd02 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -821,7 +821,9 @@ class ChessRules this.shouldReturn = false; const maxeval = VariantRules.INFINITY; const color = this.turn; - let moves1 = this.getAllValidMoves(); + // Some variants may show a bigger moves list to the human (Switching), + // thus the argument "computer" below (which is generally ignored) + let moves1 = this.getAllValidMoves("computer"); // Can I mate in 1 ? (for Magnetic & Extinction) for (let i of _.shuffle(_.range(moves1.length))) @@ -843,7 +845,7 @@ class ChessRules { eval2 = (color=="w" ? 1 : -1) * maxeval; //initialized with checkmate value // Second half-move: - let moves2 = this.getAllValidMoves(); + let moves2 = this.getAllValidMoves("computer"); for (let j=0; j