From: Benjamin Auder Date: Sat, 8 Dec 2018 00:39:20 +0000 (+0100) Subject: Improve Switching chess: avoid duplicate moves for analysis, better notation X-Git-Url: https://git.auder.net/game/vendor/current/css/index.css?a=commitdiff_plain;h=15952ada1d73262371654351ab8a4471f64010fd;p=vchess.git Improve Switching chess: avoid duplicate moves for analysis, better notation --- diff --git a/TODO b/TODO index 1aae2fb1..26aabd51 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ +Allow to navigate in game after it's over (back/play) For animation, moves should contains "moving" and "fading" maybe... (But it's really just for Magnetic chess) setInterval "CRON" task in sockets.js to check connected clients 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=0 && i=0 && j