-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
index.html
30 lines (27 loc) · 932 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<script src="stockfish.js"></script>
<script>
Stockfish().then(sf => {
window.sf = sf;
var depth = 5;
var listener = function (line) {
console.log('>', line);
if (line.includes('bestmove') && depth < 25) {
depth++;
console.log('============ DEPTH ' + depth + ' ============');
sf.postMessage('go depth ' + depth);
}
};
sf.addMessageListener(listener);
//sf.removeMessageListener(listener);
sf.postMessage('uci');
sf.postMessage('setoption name UCI_AnalyseMode value true');
sf.postMessage('setoption name Analysis Contempt value Off');
setTimeout(() => {
console.log('============ START ============');
sf.postMessage('setoption name Threads value 32');
sf.postMessage('setoption name Hash value 1024');
sf.postMessage('position fen 4r1k1/r1q2ppp/ppp2n2/4P3/5Rb1/1N1BQ3/PPP3PP/R5K1 w - - 1 17');
sf.postMessage('go depth ' + depth);
}, 3000);
});
</script>