cm-engine-runner 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -32,14 +32,14 @@ export class PolyglotRunner extends EngineRunner {
|
|
|
32
32
|
if(this.props.debug) {
|
|
33
33
|
console.log(fen, "moves found in opening book", moves)
|
|
34
34
|
}
|
|
35
|
-
// handle
|
|
35
|
+
// handle probability
|
|
36
36
|
const propabilityMatrix = []
|
|
37
37
|
for (const move of moves) {
|
|
38
38
|
for (let i = 0; i < (move.probability * 10); i++) {
|
|
39
39
|
propabilityMatrix.push(move)
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
//
|
|
42
|
+
// probability weighted random
|
|
43
43
|
const luckyIndex = Math.floor(Math.random() * propabilityMatrix.length)
|
|
44
44
|
resolve(propabilityMatrix[luckyIndex])
|
|
45
45
|
})
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Author and copyright: Stefan Haack (https://shaack.com)
|
|
3
|
-
* Repository: https://github.com/shaack/cm-engine-runner
|
|
3
|
+
* Repository: https://github.com/shaack/cm-chess-engine-runner
|
|
4
4
|
* License: MIT, see file 'LICENSE'
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {ENGINE_STATE, EngineRunner} from "./EngineRunner.js"
|
|
8
8
|
|
|
9
9
|
const LEVEL_DEPTH = {
|
|
10
|
-
1:
|
|
11
|
-
2:
|
|
12
|
-
3:
|
|
13
|
-
4:
|
|
14
|
-
5:
|
|
15
|
-
6:
|
|
16
|
-
7:
|
|
17
|
-
8:
|
|
18
|
-
9:
|
|
19
|
-
10:
|
|
10
|
+
1: 1,
|
|
11
|
+
2: 2,
|
|
12
|
+
3: 3,
|
|
13
|
+
4: 4,
|
|
14
|
+
5: 5,
|
|
15
|
+
6: 7,
|
|
16
|
+
7: 9,
|
|
17
|
+
8: 12,
|
|
18
|
+
9: 15,
|
|
19
|
+
10: 18
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export class StockfishRunner extends EngineRunner {
|
|
@@ -121,4 +121,4 @@ export class StockfishRunner extends EngineRunner {
|
|
|
121
121
|
this.engineWorker.postMessage(cmd)
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
}
|
|
124
|
+
}
|