X-Git-Url: https://git.auder.net/%3C?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=c24c84c619459b0135dff775635c0aa12262b4e3;hb=9de73b71a1db5464f89a202e6cdfdc7b6b6b0753;hp=346eff0df94e3d8a4317c5fc8cd351f4b4e904cb;hpb=0b5fa571c10c5d5befc81b3984ead9b4b1a3e14e;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 346eff0d..c24c84c6 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -503,25 +503,25 @@ class ChessRules // No: if happen on last 1/2 move, could lead to forbidden moves, wrong evals return this.filterValid(potentialMoves); } - + // Stop at the first move found atLeastOneMove() { const color = this.turn; const oppCol = this.getOppCol(color); let [sizeX,sizeY] = VariantRules.size; - for (var i=0; i 0) { - for (let i=0; i 0) + if (this.filterValid([moves[k]]).length > 0) return true; } } @@ -824,7 +824,7 @@ class ChessRules for (let j=1; j { return [this.getNotation(m), m.eval]; })); +// console.log(moves1.map(m => { return [this.getNotation(m), m.eval]; })); return moves1[_.sample(candidates, 1)]; }