@renju-note/quintet 0.7.0 → 0.9.1

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,41 +4,78 @@ Renju mate solver compilable to WebAssemby
4
4
 
5
5
  ## Run
6
6
 
7
+ ### VCF
8
+
7
9
  ```
8
- $ cargo run --release --example solve
9
- Finished release [optimized] target(s) in 0.01s
10
- Running `target/release/examples/solve`
10
+ $ cargo build --release --example solve_vcf
11
11
 
12
- Board code (blacks/whites):
13
- H8,F6,I7,G6,F8,F9,E7,H4,J6,J4,J5,J8,I4,K6,L6,I2,L5,M7,I8,K8,D5,F4,H3,E2,J11,G11,E10,F13,B11,D12/H7,G7,G9,H6,E8,F7,D6,G5,I5,K5,J3,J7,K4,L7,M6,N7,K7,G4,G8,L8,E4,F3,G2,I10,F11,D9,E12,C10,C12
12
+ $ ./target/release/examples/solve_vcf x H8,H7,F6,G7,I7,G9,G6,H6,F8,E8,F9,F7,E7,D6,H4,G5,J6,I5,J4,K5,J5,J3,J8,J7,I4,K4,K6,L7,L6,M6,I2,N7,L5,K7,M7,G4,I8,G8,K8,L8,D5,E4,F4,F3,H3,G2,
13
+ E2,I10,J11,F11,G11,D9,E10,E12,F13,C10,B11,C12,D12
14
+ Player: White
14
15
 
15
16
  Board:
16
- ---------------
17
- ---------------
18
- -----o---------
19
- --xox----------
20
- -o---xo--o-----
21
- --x-o---x------
22
- ---x-ox--------
23
- ----xoxoooox---
24
- ----oxxxoxxxox-
25
- ---x-oox-ooox--
26
- ---o--x-xoxo---
27
- ----xoxooox----
28
- -----x-o-x-----
29
- ----o-x-o------
30
- ---------------
31
-
32
- Black VCF:
33
- None
34
- Elapsed: 236.429µs
35
-
36
- White VCF:
37
- 8 moves
38
- G1,G3,E6,H9,H5,I6,F5,E5,C8,D7,C11,C9,C14,C13,D13
39
- Elapsed: 945.527µs
17
+
18
+ 15 . . . . . . . . . . . . . . .
19
+ 14 . . . . . . . . . . . . . . .
20
+ 13 . . . . . o . . . . . . . . .
21
+ 12 . . x o x . . . . . . . . . .
22
+ 11 . o . . . x o . . o . . . . .
23
+ 10 . . x . o . . . x . . . . . .
24
+ 9 . . . x . o x . . . . . . . .
25
+ 8 . . . . x o x o o o o x . . .
26
+ 7 . . . . o x x x o x x x o x .
27
+ 6 . . . x . o o x . o o o x . .
28
+ 5 . . . o . . x . x o x o . . .
29
+ 4 . . . . x o x o o o x . . . .
30
+ 3 . . . . . x . o . x . . . . .
31
+ 2 . . . . o . x . o . . . . . .
32
+ 1 . . . . . . . . . . . . . . .
33
+ A B C D E F G H I J K L M N O
34
+
35
+ Solving...
36
+
37
+ Elapsed: 1.414262ms
38
+ 7 times
39
+ H5,I6,E6,H9,F5,E5,C8,D7,C11,C9,C14,C13,D13
40
40
  ```
41
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
+
42
79
  ## Release
43
80
 
44
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.7.0",
7
+ "version": "0.9.1",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
package/quintet.d.ts CHANGED
@@ -4,10 +4,26 @@
4
4
  * @param {Uint8Array} blacks
5
5
  * @param {Uint8Array} whites
6
6
  * @param {boolean} black
7
- * @param {number} depth_limit
7
+ * @param {number} max_depth
8
8
  * @returns {Uint8Array | undefined}
9
9
  */
10
- export function solve_vcf(blacks: Uint8Array, whites: Uint8Array, black: boolean, depth_limit: number): Uint8Array | undefined;
10
+ export function solve_vcf(blacks: Uint8Array, whites: Uint8Array, black: boolean, max_depth: number): Uint8Array | undefined;
11
+ /**
12
+ * @param {Uint8Array} blacks
13
+ * @param {Uint8Array} whites
14
+ * @param {boolean} black
15
+ * @param {number} max_depth
16
+ * @returns {Uint8Array | undefined}
17
+ */
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;
11
27
  /**
12
28
  * @param {number} x
13
29
  * @param {number} y
package/quintet_bg.js CHANGED
@@ -32,17 +32,73 @@ function getArrayU8FromWasm0(ptr, len) {
32
32
  * @param {Uint8Array} blacks
33
33
  * @param {Uint8Array} whites
34
34
  * @param {boolean} black
35
- * @param {number} depth_limit
35
+ * @param {number} max_depth
36
36
  * @returns {Uint8Array | undefined}
37
37
  */
38
- export function solve_vcf(blacks, whites, black, depth_limit) {
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_limit);
45
+ wasm.solve_vcf(retptr, ptr0, len0, ptr1, len1, black, max_depth);
46
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
47
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
48
+ let v2;
49
+ if (r0 !== 0) {
50
+ v2 = getArrayU8FromWasm0(r0, r1).slice();
51
+ wasm.__wbindgen_free(r0, r1 * 1);
52
+ }
53
+ return v2;
54
+ } finally {
55
+ wasm.__wbindgen_add_to_stack_pointer(16);
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @param {Uint8Array} blacks
61
+ * @param {Uint8Array} whites
62
+ * @param {boolean} black
63
+ * @param {number} max_depth
64
+ * @returns {Uint8Array | undefined}
65
+ */
66
+ export function solve_vct(blacks, whites, black, max_depth) {
67
+ try {
68
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
69
+ var ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
70
+ var len0 = WASM_VECTOR_LEN;
71
+ var ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
72
+ var len1 = WASM_VECTOR_LEN;
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);
46
102
  var r0 = getInt32Memory0()[retptr / 4 + 0];
47
103
  var r1 = getInt32Memory0()[retptr / 4 + 1];
48
104
  let v2;
package/quintet_bg.wasm CHANGED
Binary file