X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTeleport.js;h=93648c483b9147a4a3af42743265b443a223ce7c;hp=2379692a922ca2c4df2bf672a379664adacdf9b7;hb=ff0150d1eb0ce3778310e67bb4ce87d0666a37d7;hpb=b1fea144e72b3bce1a2d2c630618805eb45424b4 diff --git a/client/src/variants/Teleport.js b/client/src/variants/Teleport.js index 2379692a..93648c48 100644 --- a/client/src/variants/Teleport.js +++ b/client/src/variants/Teleport.js @@ -299,10 +299,13 @@ export class TeleportRules extends ChessRules { moves2.forEach(m2 => { this.play(m2); const score = this.getCurrentScore(); - const mvEval = - ["1-0", "0-1"].includes(score) - ? (score == "1-0" ? 1 : -1) * maxeval - : (score == "1/2" ? 0 : initEval); + let mvEval = 0; + if (["1-0", "0-1"].includes(score)) + mvEval = (score == "1-0" ? 1 : -1) * maxeval; + else if (score == "*") + // Add small fluctuations to avoid dropping pieces always on the + // first square available. + mvEval = initEval + 0.05 - Math.random() / 10; if ( (color == 'w' && mvEval > m.eval) || (color == 'b' && mvEval < m.eval)