X-Git-Url: https://git.auder.net/js/rpsls.js?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=ec5f9372f826e15ea1f0b4848e001f67101c03fb;hb=0f51ef985c094530a63d242dddf514e66d23959b;hp=cb426f3f4f9bfbc0406c7e38904f3a7ce0ffbcfd;hpb=270968d6f8b17065cfe18279d9ee7973107a1048;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index cb426f3f..ec5f9372 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; } } @@ -699,8 +699,6 @@ class ChessRules play(move, ingame) { - console.log("play " + this.getNotation(move)); - console.log(JSON.stringify(move)); if (!!ingame) move.notation = this.getNotation(move); @@ -718,7 +716,6 @@ class ChessRules this.moves.pop(); this.unupdateVariables(move); this.parseFlags(JSON.parse(move.flags)); - console.log("undo " + this.getNotation(move)); } ////////////// @@ -827,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)]; } @@ -1050,6 +1047,7 @@ class ChessRules pgn += '[Site "vchess.club"]
'; const d = new Date(); const opponent = mode=="human" ? "Anonymous" : "Computer"; + pgn += '[Variant "' + variant + '"]
'; pgn += '[Date "' + d.getFullYear() + '-' + (d.getMonth()+1) + '-' + d.getDate() + '"]
'; pgn += '[White "' + (mycolor=='w'?'Myself':opponent) + '"]
'; pgn += '[Black "' + (mycolor=='b'?'Myself':opponent) + '"]
';