@renju-note/quintet 0.10.2 → 0.10.4
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 +3 -3
- package/package.json +5 -2
- package/quintet.js +3 -1
- package/quintet_bg.js +52 -45
- package/quintet_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# quintet
|
|
2
2
|
|
|
3
|
-
Renju mate solver compilable to
|
|
3
|
+
Renju mate solver compilable to WebAssembly
|
|
4
4
|
|
|
5
5
|
## Run
|
|
6
6
|
|
|
7
7
|
### VCF
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
% cargo run --release --example solve vcf 10 x \
|
|
10
|
+
% cargo run --release --example solve vcf 10 5 x \
|
|
11
11
|
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,E2,I10,J11,F11,G11,D9,E10,E12,F13,C10,B11,C12,D12
|
|
12
12
|
Finished release [optimized] target(s) in 0.00s
|
|
13
13
|
Running `target/release/examples/solve vcf 10 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,E2,I10,J11,F11,G11,D9,E10,E12,F13,C10,B11,C12,D12`
|
|
@@ -42,7 +42,7 @@ Solution: G1,G3,E6,H9,H5,I6,F5,E5,C8,D7,C11,C9,C14,C13,D13
|
|
|
42
42
|
### VCT
|
|
43
43
|
|
|
44
44
|
```
|
|
45
|
-
% cargo run --release --example solve
|
|
45
|
+
% cargo run --release --example solve vct_dfpns 255 3 x \
|
|
46
46
|
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,G6,E6,D5,F5,G4
|
|
47
47
|
Finished release [optimized] target(s) in 0.03s
|
|
48
48
|
Running `target/release/examples/solve vct_dfpn 255 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,G6,E6,D5,F5,G4`
|
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.10.
|
|
7
|
+
"version": "0.10.4",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"module": "quintet.js",
|
|
20
20
|
"types": "quintet.d.ts",
|
|
21
|
-
"sideEffects":
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./quintet.js",
|
|
23
|
+
"./snippets/*"
|
|
24
|
+
]
|
|
22
25
|
}
|
package/quintet.js
CHANGED
package/quintet_bg.js
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let cachedUint8Memory0 = null;
|
|
2
8
|
|
|
3
|
-
let cachegetUint8Memory0 = null;
|
|
4
9
|
function getUint8Memory0() {
|
|
5
|
-
if (
|
|
6
|
-
|
|
10
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
11
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
7
12
|
}
|
|
8
|
-
return
|
|
13
|
+
return cachedUint8Memory0;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
let WASM_VECTOR_LEN = 0;
|
|
12
17
|
|
|
13
18
|
function passArray8ToWasm0(arg, malloc) {
|
|
14
|
-
const ptr = malloc(arg.length * 1);
|
|
19
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
15
20
|
getUint8Memory0().set(arg, ptr / 1);
|
|
16
21
|
WASM_VECTOR_LEN = arg.length;
|
|
17
22
|
return ptr;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
let
|
|
25
|
+
let cachedInt32Memory0 = null;
|
|
26
|
+
|
|
21
27
|
function getInt32Memory0() {
|
|
22
|
-
if (
|
|
23
|
-
|
|
28
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
29
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
24
30
|
}
|
|
25
|
-
return
|
|
31
|
+
return cachedInt32Memory0;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
function getArrayU8FromWasm0(ptr, len) {
|
|
35
|
+
ptr = ptr >>> 0;
|
|
29
36
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
@@ -40,19 +47,19 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
40
47
|
export function solve(mode, limit, blacks, whites, black, threat_limit) {
|
|
41
48
|
try {
|
|
42
49
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
const ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
|
|
51
|
+
const len0 = WASM_VECTOR_LEN;
|
|
52
|
+
const ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
|
|
53
|
+
const len1 = WASM_VECTOR_LEN;
|
|
47
54
|
wasm.solve(retptr, mode, limit, ptr0, len0, ptr1, len1, black, threat_limit);
|
|
48
55
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
49
56
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
50
|
-
let
|
|
57
|
+
let v3;
|
|
51
58
|
if (r0 !== 0) {
|
|
52
|
-
|
|
53
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
59
|
+
v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
60
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
54
61
|
}
|
|
55
|
-
return
|
|
62
|
+
return v3;
|
|
56
63
|
} finally {
|
|
57
64
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
58
65
|
}
|
|
@@ -68,19 +75,19 @@ export function solve(mode, limit, blacks, whites, black, threat_limit) {
|
|
|
68
75
|
export function solve_vcf(blacks, whites, black, limit) {
|
|
69
76
|
try {
|
|
70
77
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
const ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
|
|
79
|
+
const len0 = WASM_VECTOR_LEN;
|
|
80
|
+
const ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
|
|
81
|
+
const len1 = WASM_VECTOR_LEN;
|
|
75
82
|
wasm.solve_vcf(retptr, ptr0, len0, ptr1, len1, black, limit);
|
|
76
83
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
77
84
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
78
|
-
let
|
|
85
|
+
let v3;
|
|
79
86
|
if (r0 !== 0) {
|
|
80
|
-
|
|
81
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
87
|
+
v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
88
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
82
89
|
}
|
|
83
|
-
return
|
|
90
|
+
return v3;
|
|
84
91
|
} finally {
|
|
85
92
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
86
93
|
}
|
|
@@ -96,19 +103,19 @@ export function solve_vcf(blacks, whites, black, limit) {
|
|
|
96
103
|
export function solve_vct(blacks, whites, black, limit) {
|
|
97
104
|
try {
|
|
98
105
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
|
|
107
|
+
const len0 = WASM_VECTOR_LEN;
|
|
108
|
+
const ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
|
|
109
|
+
const len1 = WASM_VECTOR_LEN;
|
|
103
110
|
wasm.solve_vct(retptr, ptr0, len0, ptr1, len1, black, limit);
|
|
104
111
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
105
112
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
106
|
-
let
|
|
113
|
+
let v3;
|
|
107
114
|
if (r0 !== 0) {
|
|
108
|
-
|
|
109
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
115
|
+
v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
116
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
110
117
|
}
|
|
111
|
-
return
|
|
118
|
+
return v3;
|
|
112
119
|
} finally {
|
|
113
120
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
114
121
|
}
|
|
@@ -124,19 +131,19 @@ export function solve_vct(blacks, whites, black, limit) {
|
|
|
124
131
|
export function solve_vct_dfpn(blacks, whites, black, limit) {
|
|
125
132
|
try {
|
|
126
133
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
const ptr0 = passArray8ToWasm0(blacks, wasm.__wbindgen_malloc);
|
|
135
|
+
const len0 = WASM_VECTOR_LEN;
|
|
136
|
+
const ptr1 = passArray8ToWasm0(whites, wasm.__wbindgen_malloc);
|
|
137
|
+
const len1 = WASM_VECTOR_LEN;
|
|
131
138
|
wasm.solve_vct_dfpn(retptr, ptr0, len0, ptr1, len1, black, limit);
|
|
132
139
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
133
140
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
134
|
-
let
|
|
141
|
+
let v3;
|
|
135
142
|
if (r0 !== 0) {
|
|
136
|
-
|
|
137
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
143
|
+
v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
144
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
138
145
|
}
|
|
139
|
-
return
|
|
146
|
+
return v3;
|
|
140
147
|
} finally {
|
|
141
148
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
142
149
|
}
|
|
@@ -148,7 +155,7 @@ export function solve_vct_dfpn(blacks, whites, black, limit) {
|
|
|
148
155
|
* @returns {number}
|
|
149
156
|
*/
|
|
150
157
|
export function encode_xy(x, y) {
|
|
151
|
-
|
|
158
|
+
const ret = wasm.encode_xy(x, y);
|
|
152
159
|
return ret;
|
|
153
160
|
}
|
|
154
161
|
|
|
@@ -157,7 +164,7 @@ export function encode_xy(x, y) {
|
|
|
157
164
|
* @returns {number}
|
|
158
165
|
*/
|
|
159
166
|
export function decode_x(code) {
|
|
160
|
-
|
|
167
|
+
const ret = wasm.decode_x(code);
|
|
161
168
|
return ret;
|
|
162
169
|
}
|
|
163
170
|
|
|
@@ -166,7 +173,7 @@ export function decode_x(code) {
|
|
|
166
173
|
* @returns {number}
|
|
167
174
|
*/
|
|
168
175
|
export function decode_y(code) {
|
|
169
|
-
|
|
176
|
+
const ret = wasm.decode_y(code);
|
|
170
177
|
return ret;
|
|
171
178
|
}
|
|
172
179
|
|
package/quintet_bg.wasm
CHANGED
|
Binary file
|