From 76af7618ac10758673cf21216cbcd5191bfb625c Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Tue, 20 Sep 2016 11:39:57 +0200 Subject: [PATCH] Upgrade to Sunsetter8 (fixes #2199) --- .gitmodules | 7 ++++--- public/vendor/Sunsetter | 1 - public/vendor/Sunsetter8 | 1 + ui/analyse/src/ceval/sunsetterWorker.js | 15 +++++---------- 4 files changed, 10 insertions(+), 14 deletions(-) delete mode 160000 public/vendor/Sunsetter create mode 160000 public/vendor/Sunsetter8 diff --git a/.gitmodules b/.gitmodules index f6c2c412fc..efca0b4ec5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,9 +31,6 @@ [submodule "public/vendor/stockfish.js"] path = public/vendor/stockfish.js url = https://github.com/niklasf/stockfish.js -[submodule "public/vendor/Sunsetter"] - path = public/vendor/Sunsetter - url = https://github.com/niklasf/Sunsetter.git [submodule "public/vendor/flatpickr"] path = public/vendor/flatpickr url = https://github.com/chmln/flatpickr @@ -43,3 +40,7 @@ [submodule "public/visualizer"] path = public/visualizer url = https://github.com/ornicar/chess_game_visualizer +[submodule "public/vendor/Sunsetter8"] + path = public/vendor/Sunsetter8 + url = https://github.com/niklasf/Sunsetter8 + branch = js diff --git a/public/vendor/Sunsetter b/public/vendor/Sunsetter deleted file mode 160000 index db96881581..0000000000 --- a/public/vendor/Sunsetter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit db96881581000cb03ccc6b8173a3cf0b89078bc3 diff --git a/public/vendor/Sunsetter8 b/public/vendor/Sunsetter8 new file mode 160000 index 0000000000..3744246dd1 --- /dev/null +++ b/public/vendor/Sunsetter8 @@ -0,0 +1 @@ +Subproject commit 3744246dd1edcb061228030247887ab86f0153cc diff --git a/ui/analyse/src/ceval/sunsetterWorker.js b/ui/analyse/src/ceval/sunsetterWorker.js index 85abc0c713..a92bae0b52 100644 --- a/ui/analyse/src/ceval/sunsetterWorker.js +++ b/ui/analyse/src/ceval/sunsetterWorker.js @@ -61,20 +61,14 @@ module.exports = function(opts, name) { // transform mate scores if (Math.abs(cp) > 20000) { - mate = Math.floor((30000 - Math.abs(cp)) / 10); + mate = Math.floor((30000 - Math.abs(cp)) / 10) + 1; // approx depth for searches that end early with mate depth = Math.max(depth || 0, mate * 2 - 1); // correct sign and add sunsetter played moves - mate = Math.sign(cp) * (mate + aiMoves) + mate = Math.sign(cp) * (mate + aiMoves); cp = undefined; } - if (mate) { - stopping = true - send('force'); - send('tellics stopped'); - } - work.emit({ work: work, eval: { @@ -89,7 +83,7 @@ module.exports = function(opts, name) { var reboot = function() { if (instance) instance.terminate(); - instance = new Worker('/assets/vendor/Sunsetter/sunsetter.js'); + instance = new Worker('/assets/vendor/Sunsetter8/sunsetter.js'); busy = false; stopping = false; aiMoves = 0; @@ -102,8 +96,9 @@ module.exports = function(opts, name) { start: function(work) { if (busy) reboot(); busy = true; - send('variant ' + opts.variant.key); + send('reset ' + opts.variant.key); send('setboard ' + work.initialFen); + send('easy'); send('force'); for (var i = 0; i < work.moves.length; i++) { send(work.moves[i]);