1 // For asynchronous computer move search
2 onmessage = function(e
)
8 '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js',
9 '/javascripts/base_rules.js',
10 '/javascripts/utils/array.js',
11 '/javascripts/variants/' + e
.data
[1] + '.js');
12 self
.V
= VariantRules
;
15 const fen
= e
.data
[1];
16 self
.vr
= new VariantRules(fen
, []);
19 self
.vr
.play(e
.data
[1]);
23 console
.log("IN playCompMove " + self
.vr
.moves
.length
+ " " + self
.vr
.turn
);
25 const compMove
= self
.vr
.getComputerMove();
26 postMessage(compMove
);