@renju-note/quintet 0.8.0 → 0.9.2

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/README.md CHANGED
@@ -4,6 +4,8 @@ Renju mate solver compilable to WebAssemby
4
4
 
5
5
  ## Run
6
6
 
7
+ ### VCF
8
+
7
9
  ```
8
10
  $ cargo build --release --example solve_vcf
9
11
 
@@ -37,6 +39,43 @@ Elapsed: 1.414262ms
37
39
  H5,I6,E6,H9,F5,E5,C8,D7,C11,C9,C14,C13,D13
38
40
  ```
39
41
 
42
+ ### VCT
43
+
44
+ ```
45
+ $ cargo build --release --example solve_vct_dfpn
46
+
47
+ $ ./target/release/examples/solve_vct_dfpn x H8,I9,H7,J8,F8,H9,G9,H10,G11,F10,I10,G10,I8,J9,E10,K9,L9,G8,J10,K7,L6,K8,K6,L10,I7,J6,M9,I5,H4,F7,
48
+ G6,E6,D5,F5,G4
49
+ Player: White
50
+
51
+ Board:
52
+
53
+ 15 . . . . . . . . . . . . . . .
54
+ 14 . . . . . . . . . . . . . . .
55
+ 13 . . . . . . . . . . . . . . .
56
+ 12 . . . . . . . . . . . . . . .
57
+ 11 . . . . . . o . . . . . . . .
58
+ 10 . . . . o x x x o o . x . . .
59
+ 9 . . . . . . o x x x x o o . .
60
+ 8 . . . . . o x o o x x . . . .
61
+ 7 . . . . . x . o o . x . . . .
62
+ 6 . . . . x . o . . x o o . . .
63
+ 5 . . . o . x . . x . . . . . .
64
+ 4 . . . . . . o o . . . . . . .
65
+ 3 . . . . . . . . . . . . . . .
66
+ 2 . . . . . . . . . . . . . . .
67
+ 1 . . . . . . . . . . . . . . .
68
+ A B C D E F G H I J K L M N O
69
+
70
+ Solving...
71
+
72
+ Elapsed: 8.763508458s
73
+ 23 times
74
+ K11,K10,N12,M11,N8,H5,H6,L8,J5,J7,M5,L4,M6,K5,N5,L7,J4,G7,K3,L2,M4,M3,M8,M7,N7,I6,F3,G5,G3,O1,N2,K2,F4,F6,F1,F2,J3,J2,I3,H3,N4,N6,N1,N3,K4
75
+ ```
76
+
77
+ Original game: https://www.renju.net/media/games.php?gameid=92337
78
+
40
79
  ## Release
41
80
 
42
81
  ```
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "yubessy <yubessy0@gmail.com>"
5
5
  ],
6
6
  "description": "Renju mate solver compilable to WebAssemby",
7
- "version": "0.8.0",
7
+ "version": "0.9.2",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
package/quintet.d.ts CHANGED
@@ -4,18 +4,26 @@
4
4
  * @param {Uint8Array} blacks
5
5
  * @param {Uint8Array} whites
6
6
  * @param {boolean} black
7
- * @param {number} depth
7
+ * @param {number} max_depth
8
8
  * @returns {Uint8Array | undefined}
9
9
  */
10
- export function solve_vcf(blacks: Uint8Array, whites: Uint8Array, black: boolean, depth: number): Uint8Array | undefined;
10
+ export function solve_vcf(blacks: Uint8Array, whites: Uint8Array, black: boolean, max_depth: number): Uint8Array | undefined;
11
11
  /**
12
12
  * @param {Uint8Array} blacks
13
13
  * @param {Uint8Array} whites
14
14
  * @param {boolean} black
15
- * @param {number} depth
15
+ * @param {number} max_depth
16
16
  * @returns {Uint8Array | undefined}
17
17
  */
18
- export function solve_vct(blacks: Uint8Array, whites: Uint8Array, black: boolean, depth: number): Uint8Array | undefined;
18
+ export function solve_vct(blacks: Uint8Array, whites: Uint8Array, black: boolean, max_depth: number): Uint8Array | undefined;
19
+ /**
20
+ * @param {Uint8Array} blacks
21
+ * @param {Uint8Array} whites
22
+ * @param {boolean} black
23
+ * @param {number} max_depth
24
+ * @returns {Uint8Array | undefined}
25
+ */
26
+ export function solve_vct_dfpn(blacks: Uint8Array, whites: Uint8Array, black: boolean, max_depth: number): Uint8Array | undefined;
19
27
  /**
20
28
  * @param {number} x
21
29
  * @param {number} y
package/quintet_bg.js CHANGED
@@ -32,17 +32,17 @@ function getArrayU8FromWasm0(ptr, len) {
32
32
  * @param {Uint8Array} blacks
33
33
  * @param {Uint8Array} whites
34
34
  * @param {boolean} black
35
- * @param {number} depth
35
+ * @param {number} max_depth
36
36
  * @returns {Uint8Array | undefined}
37
37
  */
38
- export function solve_vcf(blacks, whites, black, depth) {
38
+ export function solve_vcf(blacks, whites, black, max_depth) {
39
39
  try {
40
40
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
41
41
  var ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
42
42
  var len0 = WASM_VECTOR_LEN;
43
43
  var ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
44
44
  var len1 = WASM_VECTOR_LEN;
45
- wasm.solve_vcf(retptr, ptr0, len0, ptr1, len1, black, depth);
45
+ wasm.solve_vcf(retptr, ptr0, len0, ptr1, len1, black, max_depth);
46
46
  var r0 = getInt32Memory0()[retptr / 4 + 0];
47
47
  var r1 = getInt32Memory0()[retptr / 4 + 1];
48
48
  let v2;
@@ -60,17 +60,45 @@ export function solve_vcf(blacks, whites, black, depth) {
60
60
  * @param {Uint8Array} blacks
61
61
  * @param {Uint8Array} whites
62
62
  * @param {boolean} black
63
- * @param {number} depth
63
+ * @param {number} max_depth
64
64
  * @returns {Uint8Array | undefined}
65
65
  */
66
- export function solve_vct(blacks, whites, black, depth) {
66
+ export function solve_vct(blacks, whites, black, max_depth) {
67
67
  try {
68
68
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
69
69
  var ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
70
70
  var len0 = WASM_VECTOR_LEN;
71
71
  var ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
72
72
  var len1 = WASM_VECTOR_LEN;
73
- wasm.solve_vct(retptr, ptr0, len0, ptr1, len1, black, depth);
73
+ wasm.solve_vct(retptr, ptr0, len0, ptr1, len1, black, max_depth);
74
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
75
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
76
+ let v2;
77
+ if (r0 !== 0) {
78
+ v2 = getArrayU8FromWasm0(r0, r1).slice();
79
+ wasm.__wbindgen_free(r0, r1 * 1);
80
+ }
81
+ return v2;
82
+ } finally {
83
+ wasm.__wbindgen_add_to_stack_pointer(16);
84
+ }
85
+ }
86
+
87
+ /**
88
+ * @param {Uint8Array} blacks
89
+ * @param {Uint8Array} whites
90
+ * @param {boolean} black
91
+ * @param {number} max_depth
92
+ * @returns {Uint8Array | undefined}
93
+ */
94
+ export function solve_vct_dfpn(blacks, whites, black, max_depth) {
95
+ try {
96
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
97
+ var ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
98
+ var len0 = WASM_VECTOR_LEN;
99
+ var ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
100
+ var len1 = WASM_VECTOR_LEN;
101
+ wasm.solve_vct_dfpn(retptr, ptr0, len0, ptr1, len1, black, max_depth);
74
102
  var r0 = getInt32Memory0()[retptr / 4 + 0];
75
103
  var r1 = getInt32Memory0()[retptr / 4 + 1];
76
104
  let v2;
package/quintet_bg.wasm CHANGED
Binary file