Upgrade to Sunsetter8 (fixes #2199)
parent
06fb9e1371
commit
76af7618ac
|
@ -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
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit db96881581000cb03ccc6b8173a3cf0b89078bc3
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 3744246dd1edcb061228030247887ab86f0153cc
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in New Issue