@altnovatrail/picture-kit 0.1.0 → 0.2.0
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 +2 -1
- package/lib/index.d.ts +45 -1
- package/lib/index.js +34 -3
- package/lib/kinds/balance.js +2 -3
- package/lib/kinds/calendar.d.ts +5 -1
- package/lib/kinds/calendar.js +33 -11
- package/lib/kinds/chart.js +2 -4
- package/lib/kinds/clock.d.ts +5 -0
- package/lib/kinds/clock.js +45 -4
- package/lib/kinds/coins.js +3 -2
- package/lib/kinds/column.js +2 -3
- package/lib/kinds/commands.d.ts +8 -6
- package/lib/kinds/commands.js +57 -15
- package/lib/kinds/containers.js +2 -1
- package/lib/kinds/countfig.d.ts +2 -0
- package/lib/kinds/countfig.js +6 -1
- package/lib/kinds/cubes.d.ts +29 -5
- package/lib/kinds/cubes.js +82 -34
- package/lib/kinds/die.d.ts +8 -0
- package/lib/kinds/die.js +75 -14
- package/lib/kinds/domino.js +3 -3
- package/lib/kinds/dotgrid.d.ts +3 -0
- package/lib/kinds/dotgrid.js +6 -4
- package/lib/kinds/figure.js +5 -4
- package/lib/kinds/fold-parts.d.ts +0 -2
- package/lib/kinds/fold-parts.js +0 -4
- package/lib/kinds/fold.d.ts +20 -1
- package/lib/kinds/fold.js +15 -6
- package/lib/kinds/fraction.js +3 -2
- package/lib/kinds/gauges.js +2 -1
- package/lib/kinds/gears.d.ts +21 -2
- package/lib/kinds/gears.js +113 -62
- package/lib/kinds/grid.d.ts +5 -0
- package/lib/kinds/grid.js +30 -2
- package/lib/kinds/groups.d.ts +3 -1
- package/lib/kinds/groups.js +142 -28
- package/lib/kinds/lanes.js +3 -2
- package/lib/kinds/layers.d.ts +6 -0
- package/lib/kinds/layers.js +23 -4
- package/lib/kinds/line.d.ts +4 -0
- package/lib/kinds/line.js +117 -32
- package/lib/kinds/matchsticks.d.ts +4 -0
- package/lib/kinds/matchsticks.js +5 -3
- package/lib/kinds/net.js +4 -3
- package/lib/kinds/overlay.d.ts +23 -1
- package/lib/kinds/overlay.js +7 -3
- package/lib/kinds/pieces.js +3 -2
- package/lib/kinds/plane-parts.d.ts +0 -2
- package/lib/kinds/plane-parts.js +0 -6
- package/lib/kinds/plane.js +6 -6
- package/lib/kinds/ropes.js +1 -3
- package/lib/kinds/shapes.js +5 -7
- package/lib/kinds/solids.js +3 -2
- package/lib/kinds/tangram.js +2 -4
- package/lib/kinds/target.js +4 -6
- package/lib/kinds/tiles.js +5 -4
- package/lib/kinds/venn.js +3 -5
- package/lib/noto.js +1 -0
- package/lib/objects.js +2 -1
- package/lib/read.d.ts +2 -2
- package/lib/read.js +3 -3
- package/lib/solve/balance.d.ts +11 -0
- package/lib/solve/balance.js +116 -1
- package/lib/solve/calendar.d.ts +46 -0
- package/lib/solve/calendar.js +206 -0
- package/lib/solve/choice-scenes.d.ts +20 -0
- package/lib/solve/choice-scenes.js +51 -0
- package/lib/solve/clock.d.ts +54 -0
- package/lib/solve/clock.js +240 -0
- package/lib/solve/coins.d.ts +71 -0
- package/lib/solve/coins.js +222 -0
- package/lib/solve/commands.d.ts +36 -0
- package/lib/solve/commands.js +210 -0
- package/lib/solve/countfig.d.ts +41 -0
- package/lib/solve/countfig.js +199 -0
- package/lib/solve/cubes.d.ts +49 -0
- package/lib/solve/cubes.js +255 -0
- package/lib/solve/die.d.ts +39 -0
- package/lib/solve/die.js +93 -0
- package/lib/solve/domino.d.ts +57 -0
- package/lib/solve/domino.js +263 -0
- package/lib/solve/enumerate.d.ts +75 -0
- package/lib/solve/enumerate.js +323 -0
- package/lib/solve/figure.d.ts +26 -0
- package/lib/solve/figure.js +88 -0
- package/lib/solve/fold.d.ts +22 -0
- package/lib/solve/fold.js +68 -0
- package/lib/solve/gaps.d.ts +65 -0
- package/lib/solve/gaps.js +292 -0
- package/lib/solve/gears.d.ts +33 -0
- package/lib/solve/gears.js +130 -0
- package/lib/solve/grid.d.ts +35 -0
- package/lib/solve/grid.js +194 -0
- package/lib/solve/groups.d.ts +93 -0
- package/lib/solve/groups.js +346 -0
- package/lib/solve/index.d.ts +60 -0
- package/lib/solve/index.js +194 -0
- package/lib/solve/layers.d.ts +30 -0
- package/lib/solve/layers.js +72 -0
- package/lib/solve/magic.d.ts +32 -0
- package/lib/solve/magic.js +216 -0
- package/lib/solve/matchsticks.d.ts +37 -0
- package/lib/solve/matchsticks.js +214 -0
- package/lib/solve/order.d.ts +94 -0
- package/lib/solve/order.js +419 -0
- package/lib/solve/overlay.d.ts +22 -0
- package/lib/solve/overlay.js +56 -0
- package/lib/solve/parity.d.ts +22 -0
- package/lib/solve/parity.js +27 -0
- package/lib/solve/pattern.d.ts +62 -0
- package/lib/solve/pattern.js +533 -0
- package/lib/solve/pieces.d.ts +57 -0
- package/lib/solve/pieces.js +309 -0
- package/lib/solve/pigeonhole.d.ts +38 -0
- package/lib/solve/pigeonhole.js +95 -0
- package/lib/solve/proof.d.ts +115 -0
- package/lib/solve/proof.js +105 -0
- package/lib/solve/pyramid.d.ts +28 -0
- package/lib/solve/pyramid.js +161 -0
- package/lib/solve/question.d.ts +25 -0
- package/lib/solve/question.js +75 -0
- package/lib/solve/shapes.d.ts +30 -0
- package/lib/solve/shapes.js +182 -0
- package/lib/solve/target.d.ts +40 -0
- package/lib/solve/target.js +190 -0
- package/lib/style.d.ts +1 -1
- package/lib/style.js +1 -1
- package/lib/words.d.ts +15 -0
- package/lib/words.js +39 -0
- package/package.json +1 -1
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { int, isObj, only } from "../read.js";
|
|
2
|
+
import { noScene, solved, unsolved } from "./proof.js";
|
|
3
|
+
import { askOf, sceneless } from "./question.js";
|
|
4
|
+
const members = { gaps: [], points: ["between"], cuts: [], pieces: [] };
|
|
5
|
+
const takes = {
|
|
6
|
+
gaps: ["per", "points"],
|
|
7
|
+
points: ["gaps", "to"],
|
|
8
|
+
cuts: ["per", "pieces"],
|
|
9
|
+
pieces: ["cuts"],
|
|
10
|
+
};
|
|
11
|
+
/** The styles of line whose points have gaps between them. */
|
|
12
|
+
const pointed = ["fence", "row", "belt"];
|
|
13
|
+
const isPointed = (s) => pointed.includes(s.style);
|
|
14
|
+
/** drawn is how many points a line draws: posts, things, cut lines, ticks, steps or holes. */
|
|
15
|
+
function drawn(s) {
|
|
16
|
+
return s.style === "row" ? s.things.length : s.count;
|
|
17
|
+
}
|
|
18
|
+
/** pointReads are the paths of a line's points: each thing of a row, or the count of the others. */
|
|
19
|
+
function pointReads(s) {
|
|
20
|
+
return s.style === "row" ? s.things.map((_, i) => `things[${i}]`) : ["count"];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* lineFacts are the members of a line that show a fact: its points — each
|
|
24
|
+
* thing of a row, or the count of posts, holes, cut lines, ticks or steps —,
|
|
25
|
+
* the labels on its points and on its gaps where one is written, the lengths
|
|
26
|
+
* of its gaps, its whole length, each jump and each mark, and the middle it
|
|
27
|
+
* does not show.
|
|
28
|
+
*/
|
|
29
|
+
export function lineFacts(s) {
|
|
30
|
+
const out = pointReads(s);
|
|
31
|
+
if (s.labels?.some((l) => l !== ""))
|
|
32
|
+
out.push("labels");
|
|
33
|
+
if (s.gaps?.some((g) => g !== ""))
|
|
34
|
+
out.push("gaps");
|
|
35
|
+
for (const member of ["lengths", "total", "unseen"])
|
|
36
|
+
if (s[member] !== undefined)
|
|
37
|
+
out.push(member);
|
|
38
|
+
(s.jumps ?? []).forEach((_, k) => {
|
|
39
|
+
out.push(`jumps[${k}]`);
|
|
40
|
+
});
|
|
41
|
+
(s.marks ?? []).forEach((_, k) => {
|
|
42
|
+
out.push(`marks[${k}]`);
|
|
43
|
+
});
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/** necklaceFacts are each bead of every necklace, and its label and its cut where it has one. */
|
|
47
|
+
export function necklaceFacts(s) {
|
|
48
|
+
return s.necklaces.flatMap((k, i) => [
|
|
49
|
+
...k.beads.map((_, j) => `necklaces[${i}].beads[${j}]`),
|
|
50
|
+
...(k.label !== undefined ? [`necklaces[${i}].label`] : []),
|
|
51
|
+
...(k.cut !== undefined ? [`necklaces[${i}].cut`] : []),
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
/** amountOf reads a gap's label as the amount it stands for: "2 m", "3 min", "4". */
|
|
55
|
+
function amountOf(label) {
|
|
56
|
+
const m = /^(\d{1,3})(?: ?[A-Za-z]+)?$/.exec(label);
|
|
57
|
+
return m ? Number(m[1]) : undefined;
|
|
58
|
+
}
|
|
59
|
+
/** labelled is the amount the labelled gaps of a line stand for, if any are labelled. */
|
|
60
|
+
function labelled(s) {
|
|
61
|
+
const labels = (s.gaps ?? []).filter((g) => g !== "");
|
|
62
|
+
return labels.length > 0 ? amountOf(labels[0]) : undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* numbered is how many points a line whose middle is not shown has, when its
|
|
66
|
+
* labels number the points from the first: the labels at the left end are
|
|
67
|
+
* their places, and those at the right end count on to the last, whose label
|
|
68
|
+
* is the count.
|
|
69
|
+
*/
|
|
70
|
+
function numbered(s) {
|
|
71
|
+
const labels = s.labels;
|
|
72
|
+
if (!labels || s.unseen === undefined)
|
|
73
|
+
return undefined;
|
|
74
|
+
const shown = drawn(s);
|
|
75
|
+
const last = Number(labels[shown - 1]);
|
|
76
|
+
if (!/^\d{1,2}$/.test(labels[shown - 1] ?? "") || last <= shown)
|
|
77
|
+
return undefined;
|
|
78
|
+
const fits = labels.every((l, i) => l === "" || l === String(i < s.unseen ? i + 1 : last - (shown - 1 - i)));
|
|
79
|
+
return fits ? last : undefined;
|
|
80
|
+
}
|
|
81
|
+
function givensOf(givens, ask, problems) {
|
|
82
|
+
if (givens === undefined)
|
|
83
|
+
return {};
|
|
84
|
+
if (!isObj(givens)) {
|
|
85
|
+
problems.push("givens: must be an object");
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
only(givens, takes[ask], "givens", problems, `the givens of ${ask}`);
|
|
89
|
+
const limits = {
|
|
90
|
+
per: [1, 20],
|
|
91
|
+
points: [2, 20],
|
|
92
|
+
gaps: [1, 20],
|
|
93
|
+
to: [0, 999],
|
|
94
|
+
pieces: [2, 13],
|
|
95
|
+
cuts: [1, 12],
|
|
96
|
+
};
|
|
97
|
+
for (const key of takes[ask])
|
|
98
|
+
if (givens[key] !== undefined)
|
|
99
|
+
int(givens[key], `givens.${key}`, problems, ...limits[key]);
|
|
100
|
+
return givens;
|
|
101
|
+
}
|
|
102
|
+
function checkGaps(s, g, problems) {
|
|
103
|
+
if (s.kind === "necklace") {
|
|
104
|
+
if (g.points !== undefined)
|
|
105
|
+
problems.push("givens.points: a necklace shows every bead; leave points out");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (!isPointed(s)) {
|
|
109
|
+
problems.push(`style: gaps reads a fence, a row or a strip; a ${s.style} is read by ${s.style === "log" ? "cuts and pieces" : "points"}`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (s.lengths !== undefined)
|
|
113
|
+
problems.push("lengths: gaps counts gaps that are all the same; leave lengths out");
|
|
114
|
+
const labels = (s.gaps ?? []).map((l, i) => ({ l, i })).filter(({ l }) => l !== "");
|
|
115
|
+
for (const { l, i } of labels)
|
|
116
|
+
if (amountOf(l) === undefined)
|
|
117
|
+
problems.push(`gaps[${i}]: "${l}" is no amount a gap stands for, as "2 m"`);
|
|
118
|
+
const amounts = new Set(labels.map(({ l }) => amountOf(l)));
|
|
119
|
+
if (amounts.size > 1)
|
|
120
|
+
problems.push("gaps: the labelled gaps differ; gaps counts gaps that are all the same");
|
|
121
|
+
const amount = labelled(s);
|
|
122
|
+
if (amount !== undefined && g.per !== undefined && g.per !== amount)
|
|
123
|
+
problems.push(`givens.per: ${g.per}, and the picture labels a gap ${amount}`);
|
|
124
|
+
if (s.total !== undefined && s.total !== "?")
|
|
125
|
+
problems.push('total: shows the whole length the question asks; write "?" or leave it out');
|
|
126
|
+
if (s.unseen === undefined) {
|
|
127
|
+
if (g.points !== undefined)
|
|
128
|
+
problems.push("givens.points: the line shows every point; leave points out");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const told = numbered(s);
|
|
132
|
+
if (g.points === undefined && told === undefined)
|
|
133
|
+
problems.push("givens.points: the line's middle is not shown, so the statement tells how many points it has");
|
|
134
|
+
if (g.points !== undefined && g.points <= drawn(s))
|
|
135
|
+
problems.push(`givens.points: must be more than the ${drawn(s)} drawn, for the middle not shown holds more`);
|
|
136
|
+
if (g.points !== undefined && told !== undefined && g.points !== told)
|
|
137
|
+
problems.push(`givens.points: ${g.points}, and the label of the last point says ${told}`);
|
|
138
|
+
}
|
|
139
|
+
function checkPoints(s, q, g, problems) {
|
|
140
|
+
if (s.kind === "necklace") {
|
|
141
|
+
problems.push("scene.kind: points reads a line: a number line, a fence, a row or a strip");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (s.style === "numbers") {
|
|
145
|
+
if (q.between !== undefined)
|
|
146
|
+
problems.push("question.between: a number line's points are counted up to givens.to");
|
|
147
|
+
if (g.gaps !== undefined)
|
|
148
|
+
problems.push("givens.gaps: a number line takes to, not gaps");
|
|
149
|
+
const marks = s.marks ?? [];
|
|
150
|
+
if (marks.length !== 2) {
|
|
151
|
+
problems.push("marks: points reads the first two points of a number line, two marks");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (JSON.stringify(marks[0].thing) !== JSON.stringify(marks[1].thing))
|
|
155
|
+
problems.push("marks[1].thing: the two first points are marks of one thing");
|
|
156
|
+
if (marks[1].at <= marks[0].at)
|
|
157
|
+
problems.push("marks[1].at: the second point stands further along than the first");
|
|
158
|
+
const ticks = Array.from({ length: s.count }, (_, i) => (s.start ?? 0) + i * (s.by ?? 1));
|
|
159
|
+
if (g.to === undefined)
|
|
160
|
+
problems.push("givens.to: the statement tells where the last point stands");
|
|
161
|
+
else if (!ticks.includes(g.to))
|
|
162
|
+
problems.push(`givens.to: ${g.to} is not on the line`);
|
|
163
|
+
else if (g.to <= marks[1].at)
|
|
164
|
+
problems.push(`givens.to: the last point stands past the second, at ${marks[1].at}`);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!isPointed(s)) {
|
|
168
|
+
problems.push(`style: points reads a number line, a fence, a row or a strip, not a ${s.style}`);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (g.to !== undefined)
|
|
172
|
+
problems.push("givens.to: only a number line takes to");
|
|
173
|
+
const shown = drawn(s);
|
|
174
|
+
if (q.between !== undefined) {
|
|
175
|
+
const two = Array.isArray(q.between) ? q.between : [];
|
|
176
|
+
if (two.length !== 2 ||
|
|
177
|
+
!two.every((p) => Number.isInteger(p) && p >= 1 && p <= shown) ||
|
|
178
|
+
two[0] >= two[1])
|
|
179
|
+
problems.push(`question.between: must be two places from 1 to ${shown}, the first to the left, as [3, 8]`);
|
|
180
|
+
if (s.unseen !== undefined)
|
|
181
|
+
problems.push("unseen: points between two places counts them, so the line shows its middle");
|
|
182
|
+
if (g.gaps !== undefined)
|
|
183
|
+
problems.push("givens.gaps: points between two places reads the places, not gaps");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (s.unseen === undefined && g.gaps !== undefined)
|
|
187
|
+
problems.push("givens.gaps: the line shows every point; leave gaps out");
|
|
188
|
+
if (s.unseen !== undefined) {
|
|
189
|
+
if (g.gaps === undefined)
|
|
190
|
+
problems.push("givens.gaps: the line's middle is not shown, so the statement tells how many gaps it has");
|
|
191
|
+
else if (g.gaps < shown)
|
|
192
|
+
problems.push(`givens.gaps: must be at least ${shown}, for the middle not shown holds more`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function checkLog(s, ask, g, problems) {
|
|
196
|
+
if (s.kind === "necklace" || s.style !== "log") {
|
|
197
|
+
problems.push(`style: ${ask} reads a log, style log`);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (g.pieces !== undefined && g.pieces !== s.count + 1)
|
|
201
|
+
problems.push(`givens.pieces: ${g.pieces}, and the log's ${s.count} cut lines make ${s.count + 1}`);
|
|
202
|
+
if (g.cuts !== undefined && g.cuts !== s.count)
|
|
203
|
+
problems.push(`givens.cuts: ${g.cuts}, and the log has ${s.count} cut lines`);
|
|
204
|
+
}
|
|
205
|
+
function check(question, givens, scene) {
|
|
206
|
+
const problems = [];
|
|
207
|
+
const read = askOf(question, members, problems);
|
|
208
|
+
if (!read)
|
|
209
|
+
return problems;
|
|
210
|
+
const { q, ask } = read;
|
|
211
|
+
const g = givensOf(givens, ask, problems);
|
|
212
|
+
if (!scene) {
|
|
213
|
+
sceneless(ask, "a line, a necklace or a log", problems);
|
|
214
|
+
return problems;
|
|
215
|
+
}
|
|
216
|
+
if (ask === "gaps")
|
|
217
|
+
checkGaps(scene, g, problems);
|
|
218
|
+
else if (ask === "points")
|
|
219
|
+
checkPoints(scene, q, g, problems);
|
|
220
|
+
else
|
|
221
|
+
checkLog(scene, ask, g, problems);
|
|
222
|
+
return problems;
|
|
223
|
+
}
|
|
224
|
+
function solveGaps(scene, g) {
|
|
225
|
+
if (scene.kind === "necklace") {
|
|
226
|
+
const count = scene.necklaces.reduce((sum, k) => sum + k.beads.length - (k.open ? 1 : 0), 0);
|
|
227
|
+
const reads = scene.necklaces.flatMap((k, i) => k.beads.map((_, j) => `necklaces[${i}].beads[${j}]`));
|
|
228
|
+
return solved({ number: count * (g.per ?? 1) }, reads);
|
|
229
|
+
}
|
|
230
|
+
const reads = pointReads(scene);
|
|
231
|
+
let points = drawn(scene);
|
|
232
|
+
if (scene.unseen !== undefined) {
|
|
233
|
+
reads.push("unseen");
|
|
234
|
+
const told = numbered(scene);
|
|
235
|
+
if (told !== undefined)
|
|
236
|
+
reads.push("labels");
|
|
237
|
+
points = g.points ?? told;
|
|
238
|
+
}
|
|
239
|
+
const amount = labelled(scene);
|
|
240
|
+
if (amount !== undefined)
|
|
241
|
+
reads.push("gaps");
|
|
242
|
+
if (scene.total !== undefined)
|
|
243
|
+
reads.push("total");
|
|
244
|
+
return solved({ number: (points - 1) * (g.per ?? amount ?? 1) }, reads);
|
|
245
|
+
}
|
|
246
|
+
function solvePoints(scene, q, g) {
|
|
247
|
+
if (scene.style === "numbers") {
|
|
248
|
+
const [first, second] = scene.marks;
|
|
249
|
+
const reads = ["count", "marks[0]", "marks[1]"];
|
|
250
|
+
const step = second.at - first.at;
|
|
251
|
+
const span = g.to - first.at;
|
|
252
|
+
if (span % step !== 0)
|
|
253
|
+
return unsolved(`from ${first.at} to ${g.to} is no whole number of steps of ${step}`, reads);
|
|
254
|
+
return solved({ number: span / step + 1 }, reads);
|
|
255
|
+
}
|
|
256
|
+
const reads = pointReads(scene);
|
|
257
|
+
if (q.between) {
|
|
258
|
+
if (scene.labels?.some((l) => l !== ""))
|
|
259
|
+
reads.push("labels");
|
|
260
|
+
return solved({ number: q.between[1] - q.between[0] - 1 }, reads);
|
|
261
|
+
}
|
|
262
|
+
if (scene.unseen !== undefined)
|
|
263
|
+
return solved({ number: g.gaps + 1 }, [...reads, "unseen"]);
|
|
264
|
+
return solved({ number: drawn(scene) }, reads);
|
|
265
|
+
}
|
|
266
|
+
function solve(scene, question, givens) {
|
|
267
|
+
if (!scene)
|
|
268
|
+
return noScene;
|
|
269
|
+
const g = givens ?? {};
|
|
270
|
+
if (question.ask === "gaps")
|
|
271
|
+
return solveGaps(scene, g);
|
|
272
|
+
const line = scene;
|
|
273
|
+
if (question.ask === "points")
|
|
274
|
+
return solvePoints(line, question, g);
|
|
275
|
+
if (question.ask === "cuts")
|
|
276
|
+
return solved({ number: line.count * (g.per ?? 1) }, ["count"]);
|
|
277
|
+
// Pieces each marked "?" ask for what the question counts.
|
|
278
|
+
const asked = (line.gaps ?? []).length > 0 && line.gaps.every((l) => l === "?");
|
|
279
|
+
return solved({ number: line.count + 1 }, asked ? ["count", "gaps"] : ["count"]);
|
|
280
|
+
}
|
|
281
|
+
function facts(scene) {
|
|
282
|
+
return scene.kind === "necklace" ? necklaceFacts(scene) : lineFacts(scene);
|
|
283
|
+
}
|
|
284
|
+
/** gapsSolver counts points, gaps, cuts and pieces: the questions of GapsQuestion. */
|
|
285
|
+
export const gapsSolver = {
|
|
286
|
+
name: "gaps",
|
|
287
|
+
kinds: ["line", "necklace"],
|
|
288
|
+
questions: Object.keys(members),
|
|
289
|
+
check,
|
|
290
|
+
facts,
|
|
291
|
+
solve,
|
|
292
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type GearsScene } from "../kinds/gears.ts";
|
|
2
|
+
import { type Solver } from "./proof.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The questions of which way the wheels of a picture of gears turn. Two
|
|
5
|
+
* gears that mesh turn opposite ways, an open belt turns its two wheels the
|
|
6
|
+
* same way and a crossed one opposite ways; a wheel joined to none of the
|
|
7
|
+
* wheels an arrow pushes does not turn, nor does any wheel of a train with a
|
|
8
|
+
* ring that locks. A gear is named by its id.
|
|
9
|
+
*
|
|
10
|
+
* - `turn-of`: which way the gear `of` turns — the one that shows "?", if of
|
|
11
|
+
* is left out —, a text: "clockwise", "anticlockwise" or "not at all".
|
|
12
|
+
* - `same-way-as`: which other gears turn the way the gear `of` turns — the
|
|
13
|
+
* one that shows the arrow, if of is left out —, a text of their labels in
|
|
14
|
+
* the order of the scene, "C", "B and C", "B, C and D", or "none"; every
|
|
15
|
+
* gear needs a label of its own.
|
|
16
|
+
* - `how-many-same-way`: how many other gears turn the way the gear `of`
|
|
17
|
+
* turns, as for same-way-as, a number.
|
|
18
|
+
*
|
|
19
|
+
* Each train shows one arrow at most, the way it is pushed, and the gear
|
|
20
|
+
* asked about shows none: a second arrow would show what the question asks.
|
|
21
|
+
* It takes no givens.
|
|
22
|
+
*/
|
|
23
|
+
export type GearsQuestion = {
|
|
24
|
+
ask: "turn-of";
|
|
25
|
+
of?: string;
|
|
26
|
+
} | {
|
|
27
|
+
ask: "same-way-as" | "how-many-same-way";
|
|
28
|
+
of?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Which way a wheel turns. */
|
|
31
|
+
export type Spin = "clockwise" | "anticlockwise" | "not at all";
|
|
32
|
+
/** gearsSolver tells which way the wheels of a picture of gears turn: the questions of GearsQuestion. */
|
|
33
|
+
export declare const gearsSolver: Solver<GearsScene, GearsQuestion, Record<string, never>>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { trains } from "../kinds/gears.js";
|
|
2
|
+
import { text } from "../read.js";
|
|
3
|
+
import { noScene, solved } from "./proof.js";
|
|
4
|
+
import { askOf, noGivens, sceneless } from "./question.js";
|
|
5
|
+
const members = {
|
|
6
|
+
"turn-of": ["of"],
|
|
7
|
+
"same-way-as": ["of"],
|
|
8
|
+
"how-many-same-way": ["of"],
|
|
9
|
+
};
|
|
10
|
+
/** spins is which way each wheel turns: by the arrow of its train, or not at all. */
|
|
11
|
+
function spins(scene, train) {
|
|
12
|
+
return scene.gears.map((_, i) => {
|
|
13
|
+
const root = train.root[i];
|
|
14
|
+
const pushed = scene.gears.findIndex((w, k) => w.turn !== undefined && train.root[k] === root);
|
|
15
|
+
if (pushed < 0 || train.locked.has(root))
|
|
16
|
+
return "not at all";
|
|
17
|
+
const turn = scene.gears[pushed].turn;
|
|
18
|
+
if (train.side[i] === train.side[pushed])
|
|
19
|
+
return turn;
|
|
20
|
+
return turn === "clockwise" ? "anticlockwise" : "clockwise";
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** labelsOf words the labels of wheels as a list: "C", "B and C", "B, C and D". */
|
|
24
|
+
function labelsOf(wheels) {
|
|
25
|
+
const labels = wheels.map((w) => w.label);
|
|
26
|
+
if (labels.length === 0)
|
|
27
|
+
return "none";
|
|
28
|
+
if (labels.length === 1)
|
|
29
|
+
return labels[0];
|
|
30
|
+
return `${labels.slice(0, -1).join(", ")} and ${labels.at(-1)}`;
|
|
31
|
+
}
|
|
32
|
+
function check(question, givens, scene) {
|
|
33
|
+
const problems = [];
|
|
34
|
+
noGivens(givens, problems);
|
|
35
|
+
const start = problems.length;
|
|
36
|
+
const read = askOf(question, members, problems);
|
|
37
|
+
if (!read)
|
|
38
|
+
return problems;
|
|
39
|
+
const { q, ask } = read;
|
|
40
|
+
if (q.of !== undefined)
|
|
41
|
+
text(q.of, "question.of", problems, 3);
|
|
42
|
+
if (problems.length > start)
|
|
43
|
+
return problems;
|
|
44
|
+
if (!scene) {
|
|
45
|
+
sceneless(ask, "a scene of gears", problems);
|
|
46
|
+
return problems;
|
|
47
|
+
}
|
|
48
|
+
const gears = scene.gears;
|
|
49
|
+
const asked = gears.findIndex((w) => w.ask === true);
|
|
50
|
+
const arrows = gears.flatMap((w, i) => (w.turn !== undefined ? [i] : []));
|
|
51
|
+
if (arrows.length === 0)
|
|
52
|
+
problems.push("gears: no wheel shows an arrow, so nothing tells which way the train is pushed");
|
|
53
|
+
const train = trains(scene);
|
|
54
|
+
for (const i of arrows) {
|
|
55
|
+
const first = arrows.find((k) => train.root[k] === train.root[i]);
|
|
56
|
+
if (first !== i)
|
|
57
|
+
problems.push(`gears[${i}].turn: ${gears[i].id} shows the turn of its train again, after ${gears[first].id}, which is what a question asks; leave it out`);
|
|
58
|
+
}
|
|
59
|
+
let of;
|
|
60
|
+
if (q.of !== undefined)
|
|
61
|
+
of = gears.findIndex((w) => w.id === q.of);
|
|
62
|
+
else if (ask === "turn-of")
|
|
63
|
+
of = asked;
|
|
64
|
+
else
|
|
65
|
+
of = arrows.length === 1 ? arrows[0] : -1;
|
|
66
|
+
if (q.of !== undefined && of < 0)
|
|
67
|
+
problems.push(`question.of: no wheel has the id ${String(q.of)}`);
|
|
68
|
+
else if (of < 0)
|
|
69
|
+
problems.push(ask === "turn-of"
|
|
70
|
+
? "question.of: name the gear by its id, for no gear shows a question mark"
|
|
71
|
+
: "question.of: name the gear by its id, for the arrow is not on one gear alone");
|
|
72
|
+
if (problems.length > start)
|
|
73
|
+
return problems;
|
|
74
|
+
if (ask === "turn-of") {
|
|
75
|
+
if (gears[of].turn !== undefined)
|
|
76
|
+
problems.push(`question.of: ${gears[of].id} shows its arrow, so the picture answers`);
|
|
77
|
+
if (asked >= 0 && asked !== of)
|
|
78
|
+
problems.push(`question.of: the question mark stands on ${gears[asked].id}`);
|
|
79
|
+
return problems;
|
|
80
|
+
}
|
|
81
|
+
if (asked >= 0)
|
|
82
|
+
problems.push(`gears[${asked}].ask: a question mark asks of one gear, as turn-of does; leave it out`);
|
|
83
|
+
if (spins(scene, train)[of] === "not at all")
|
|
84
|
+
problems.push(`question.of: ${gears[of].id} does not turn, so no gear turns the way it turns; ask turn-of`);
|
|
85
|
+
if (ask === "same-way-as") {
|
|
86
|
+
const bare = gears.findIndex((w) => w.label === undefined);
|
|
87
|
+
if (bare >= 0)
|
|
88
|
+
problems.push(`question.ask: same-way-as names gears by their labels, and gears[${bare}] has none`);
|
|
89
|
+
else if (new Set(gears.map((w) => w.label)).size < gears.length)
|
|
90
|
+
problems.push("question.ask: same-way-as names gears by their labels, and two share one");
|
|
91
|
+
}
|
|
92
|
+
return problems;
|
|
93
|
+
}
|
|
94
|
+
function solve(scene, question) {
|
|
95
|
+
if (!scene)
|
|
96
|
+
return noScene;
|
|
97
|
+
const gears = scene.gears;
|
|
98
|
+
const reads = [
|
|
99
|
+
...gears.map((_, i) => `gears[${i}]`),
|
|
100
|
+
...(scene.belts ?? []).map((_, k) => `belts[${k}]`),
|
|
101
|
+
];
|
|
102
|
+
const turns = spins(scene, trains(scene));
|
|
103
|
+
const of = question.of !== undefined
|
|
104
|
+
? gears.findIndex((w) => w.id === question.of)
|
|
105
|
+
: question.ask === "turn-of"
|
|
106
|
+
? gears.findIndex((w) => w.ask === true)
|
|
107
|
+
: gears.findIndex((w) => w.turn !== undefined);
|
|
108
|
+
if (question.ask === "turn-of")
|
|
109
|
+
return solved({ text: turns[of] }, reads);
|
|
110
|
+
const same = gears.filter((_, i) => i !== of && turns[i] === turns[of]);
|
|
111
|
+
if (question.ask === "how-many-same-way")
|
|
112
|
+
return solved({ number: same.length }, reads);
|
|
113
|
+
return solved({ text: labelsOf(same) }, reads);
|
|
114
|
+
}
|
|
115
|
+
/** The facts of a picture of gears are its wheels, each where it stands, and its belts. */
|
|
116
|
+
function facts(scene) {
|
|
117
|
+
return [
|
|
118
|
+
...scene.gears.map((_, i) => `gears[${i}]`),
|
|
119
|
+
...(scene.belts ?? []).map((_, k) => `belts[${k}]`),
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
/** gearsSolver tells which way the wheels of a picture of gears turn: the questions of GearsQuestion. */
|
|
123
|
+
export const gearsSolver = {
|
|
124
|
+
name: "gears",
|
|
125
|
+
kinds: ["gears"],
|
|
126
|
+
questions: Object.keys(members),
|
|
127
|
+
check,
|
|
128
|
+
facts,
|
|
129
|
+
solve,
|
|
130
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type GridScene } from "../kinds/grid.ts";
|
|
2
|
+
import { type Thing } from "../things.ts";
|
|
3
|
+
import { type Solver } from "./proof.ts";
|
|
4
|
+
/**
|
|
5
|
+
* The questions about a maze or a board of squares, a grid with things in
|
|
6
|
+
* its cells. The walker moves one cell up, down, left or right at a step: to
|
|
7
|
+
* a cell of the board beside its own, never through a wall but through a
|
|
8
|
+
* door in it, and never onto a rock, the thing `nature.rock`; every other
|
|
9
|
+
* thing it may walk over. The statement names the walker, and the goal, in
|
|
10
|
+
* the givens: each must stand in exactly one cell.
|
|
11
|
+
*
|
|
12
|
+
* - `reaches`: which of the things on the board, the walker and the rocks
|
|
13
|
+
* aside, the walker can reach, a thing; exactly one must be reached, and
|
|
14
|
+
* none or two different things have no answer. Givens: the walker.
|
|
15
|
+
* - `fewest-steps`: the fewest steps from the walker to the goal, a number;
|
|
16
|
+
* a goal the walker cannot reach has no answer. Givens: the walker and the
|
|
17
|
+
* goal.
|
|
18
|
+
*
|
|
19
|
+
* Both read every cell that holds a thing or is left out of the board, the
|
|
20
|
+
* walls and the doors: the way is found by trying every cell. A cell that
|
|
21
|
+
* holds a text or a "?" is refused, as is a drawn path, which would show the
|
|
22
|
+
* way.
|
|
23
|
+
*/
|
|
24
|
+
export type GridQuestion = {
|
|
25
|
+
ask: "reaches";
|
|
26
|
+
} | {
|
|
27
|
+
ask: "fewest-steps";
|
|
28
|
+
};
|
|
29
|
+
/** The givens of a grid: the thing that walks, and for fewest-steps the thing it walks to. */
|
|
30
|
+
export type GridGivens = {
|
|
31
|
+
walker: Thing;
|
|
32
|
+
goal?: Thing;
|
|
33
|
+
};
|
|
34
|
+
/** gridSolver walks a maze or a board of squares: the questions of GridQuestion. */
|
|
35
|
+
export declare const gridSolver: Solver<GridScene, GridQuestion, GridGivens>;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { edgeKey, sides } from "../kinds/grid.js";
|
|
2
|
+
import { isObj, only } from "../read.js";
|
|
3
|
+
import { checkThing, sameThing, wordOf } from "../things.js";
|
|
4
|
+
import { article } from "../words.js";
|
|
5
|
+
import { noScene, solved, unsolved } from "./proof.js";
|
|
6
|
+
import { askOf, sceneless } from "./question.js";
|
|
7
|
+
const members = { reaches: [], "fewest-steps": [] };
|
|
8
|
+
const rock = "nature.rock";
|
|
9
|
+
const cellAt = (scene, at) => scene.cells[at[0] - 1][at[1] - 1];
|
|
10
|
+
function thingOf(cell) {
|
|
11
|
+
return cell !== null && typeof cell === "object" ? cell.thing : undefined;
|
|
12
|
+
}
|
|
13
|
+
/** placesOf lists the places of the cells that hold a thing, in the order of the rows. */
|
|
14
|
+
function placesOf(scene, thing) {
|
|
15
|
+
const out = [];
|
|
16
|
+
scene.cells.forEach((row, r) => {
|
|
17
|
+
row.forEach((cell, c) => {
|
|
18
|
+
const t = thingOf(cell);
|
|
19
|
+
if (t !== undefined && sameThing(t, thing))
|
|
20
|
+
out.push([r + 1, c + 1]);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function checkGiven(value, path, scene, problems) {
|
|
26
|
+
const before = problems.length;
|
|
27
|
+
checkThing(value, path, problems);
|
|
28
|
+
if (problems.length > before || !scene)
|
|
29
|
+
return;
|
|
30
|
+
const thing = value;
|
|
31
|
+
if (sameThing(thing, rock))
|
|
32
|
+
problems.push(`${path}: is a rock, which only stands in the way; it is no ${path.slice(7)}`);
|
|
33
|
+
const at = placesOf(scene, thing).length;
|
|
34
|
+
if (at === 0)
|
|
35
|
+
problems.push(`${path}: no cell holds ${wordOf(thing)}`);
|
|
36
|
+
if (at > 1)
|
|
37
|
+
problems.push(`${path}: ${at} cells hold ${wordOf(thing, 2)}; it stands in one`);
|
|
38
|
+
}
|
|
39
|
+
function check(question, givens, scene) {
|
|
40
|
+
const problems = [];
|
|
41
|
+
const read = askOf(question, members, problems);
|
|
42
|
+
if (!read)
|
|
43
|
+
return problems;
|
|
44
|
+
const { ask } = read;
|
|
45
|
+
const wanted = ask === "reaches" ? ["walker"] : ["walker", "goal"];
|
|
46
|
+
if (!scene)
|
|
47
|
+
sceneless(ask, "a scene of grid, the maze", problems);
|
|
48
|
+
if (!isObj(givens)) {
|
|
49
|
+
problems.push(`givens: must be an object with ${wanted.join(" and ")}, as {"walker": "animal.mouse"}`);
|
|
50
|
+
return problems;
|
|
51
|
+
}
|
|
52
|
+
only(givens, wanted, "givens", problems, `the givens of ${ask}`);
|
|
53
|
+
for (const member of wanted)
|
|
54
|
+
checkGiven(givens[member], `givens.${member}`, scene, problems);
|
|
55
|
+
if (!scene)
|
|
56
|
+
return problems;
|
|
57
|
+
if (ask === "fewest-steps" &&
|
|
58
|
+
problems.length === 0 &&
|
|
59
|
+
sameThing(givens.walker, givens.goal))
|
|
60
|
+
problems.push("givens.goal: is the walker itself");
|
|
61
|
+
scene.cells.forEach((row, r) => {
|
|
62
|
+
row.forEach((cell, c) => {
|
|
63
|
+
if (cell === null)
|
|
64
|
+
return;
|
|
65
|
+
const o = typeof cell === "string" ? (cell === "" ? {} : { text: cell }) : cell;
|
|
66
|
+
if (o.text !== undefined)
|
|
67
|
+
problems.push(`cells[${r}][${c}]: holds the text "${o.text}"; ${ask} reads things, rocks, walls and doors`);
|
|
68
|
+
const asked = o.ask === true || (isObj(o.thing) && "ask" in o.thing);
|
|
69
|
+
if (asked)
|
|
70
|
+
problems.push(`cells[${r}][${c}]: holds a "?", which would show the answer`);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
if (ask === "reaches" &&
|
|
74
|
+
problems.length === 0 &&
|
|
75
|
+
targetsOf(scene, givens.walker).length === 0)
|
|
76
|
+
problems.push("question.ask: reaches needs a thing on the board besides the walker and rocks");
|
|
77
|
+
return problems;
|
|
78
|
+
}
|
|
79
|
+
/** targetsOf lists the cells whose thing is neither the walker nor a rock. */
|
|
80
|
+
function targetsOf(scene, walker) {
|
|
81
|
+
const out = [];
|
|
82
|
+
scene.cells.forEach((row, r) => {
|
|
83
|
+
row.forEach((cell, c) => {
|
|
84
|
+
const t = thingOf(cell);
|
|
85
|
+
if (t !== undefined && !sameThing(t, walker) && !sameThing(t, rock))
|
|
86
|
+
out.push({ at: [r + 1, c + 1], thing: t });
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
const steps = {
|
|
92
|
+
top: [-1, 0],
|
|
93
|
+
right: [0, 1],
|
|
94
|
+
bottom: [1, 0],
|
|
95
|
+
left: [0, -1],
|
|
96
|
+
};
|
|
97
|
+
/** distances walks out from a place, every way at once, and gives each cell's fewest steps. */
|
|
98
|
+
function distances(scene, from) {
|
|
99
|
+
const walls = scene.walls;
|
|
100
|
+
const listed = new Set(walls === "all" || !walls ? [] : walls.map((w) => edgeKey(w.cell, w.side)));
|
|
101
|
+
const doors = new Set((scene.doors ?? []).map((d) => edgeKey(d.cell, d.side)));
|
|
102
|
+
const shut = (key) => (walls === "all" || listed.has(key)) && !doors.has(key);
|
|
103
|
+
const name = (at) => `${at[0]},${at[1]}`;
|
|
104
|
+
const out = new Map([[name(from), 0]]);
|
|
105
|
+
const todo = [from];
|
|
106
|
+
for (let i = 0; i < todo.length; i++) {
|
|
107
|
+
const here = todo[i];
|
|
108
|
+
for (const side of sides) {
|
|
109
|
+
const next = [here[0] + steps[side][0], here[1] + steps[side][1]];
|
|
110
|
+
const row = scene.cells[next[0] - 1];
|
|
111
|
+
if (!row || next[1] < 1 || next[1] > row.length)
|
|
112
|
+
continue;
|
|
113
|
+
const cell = cellAt(scene, next);
|
|
114
|
+
const t = thingOf(cell);
|
|
115
|
+
if (cell === null || (t !== undefined && sameThing(t, rock)))
|
|
116
|
+
continue;
|
|
117
|
+
if (shut(edgeKey(here, side)) || out.has(name(next)))
|
|
118
|
+
continue;
|
|
119
|
+
out.set(name(next), out.get(name(here)) + 1);
|
|
120
|
+
todo.push(next);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
/** readsOf names every cell that holds a thing or is left out, and the walls and the doors. */
|
|
126
|
+
function readsOf(scene) {
|
|
127
|
+
const cells = scene.cells.flatMap((row, r) => row.flatMap((cell, c) => cell === null || thingOf(cell) !== undefined ? [`cells[${r}][${c}]`] : []));
|
|
128
|
+
return [
|
|
129
|
+
...cells,
|
|
130
|
+
...(scene.walls === undefined ? [] : ["walls"]),
|
|
131
|
+
...(scene.doors === undefined ? [] : ["doors"]),
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
function solve(scene, question, givens) {
|
|
135
|
+
if (!scene)
|
|
136
|
+
return noScene;
|
|
137
|
+
const reads = readsOf(scene);
|
|
138
|
+
const start = placesOf(scene, givens.walker)[0];
|
|
139
|
+
const dist = distances(scene, start);
|
|
140
|
+
const key = (at) => `${at[0]},${at[1]}`;
|
|
141
|
+
if (question.ask === "fewest-steps") {
|
|
142
|
+
const goal = placesOf(scene, givens.goal)[0];
|
|
143
|
+
const d = dist.get(key(goal));
|
|
144
|
+
if (d === undefined)
|
|
145
|
+
return unsolved(`no way leads from ${wordOf(givens.walker)} to ${wordOf(givens.goal)}`, reads);
|
|
146
|
+
return solved({ number: d }, reads);
|
|
147
|
+
}
|
|
148
|
+
const reached = [];
|
|
149
|
+
for (const t of targetsOf(scene, givens.walker))
|
|
150
|
+
if (dist.has(key(t.at)) && !reached.some((r) => sameThing(r, t.thing)))
|
|
151
|
+
reached.push(t.thing);
|
|
152
|
+
if (reached.length === 1)
|
|
153
|
+
return solved({ thing: reached[0] }, reads);
|
|
154
|
+
if (reached.length === 0)
|
|
155
|
+
return unsolved(`${wordOf(givens.walker)} reaches none of the things on the board`, reads);
|
|
156
|
+
return unsolved(`${wordOf(givens.walker)} reaches ${reached.map((t) => article(wordOf(t))).join(" and ")}`, reads);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The facts of a grid are its cells that hold a text, a thing or a "?", or
|
|
160
|
+
* are left out of the board; its walls, its doors and its path; and the
|
|
161
|
+
* labels beside its rows and columns on the right and below, such as sums.
|
|
162
|
+
*/
|
|
163
|
+
function facts(scene) {
|
|
164
|
+
const cells = scene.cells.flatMap((row, r) => row.flatMap((cell, c) => {
|
|
165
|
+
const fact = cell === null ||
|
|
166
|
+
(typeof cell === "string"
|
|
167
|
+
? cell !== ""
|
|
168
|
+
: cell.text !== undefined || cell.thing !== undefined || cell.ask === true);
|
|
169
|
+
return fact ? [`cells[${r}][${c}]`] : [];
|
|
170
|
+
}));
|
|
171
|
+
const listed = (member) => {
|
|
172
|
+
const value = scene[member];
|
|
173
|
+
if (value === undefined)
|
|
174
|
+
return [];
|
|
175
|
+
return value === "all" ? [member] : value.map((_, i) => `${member}[${i}]`);
|
|
176
|
+
};
|
|
177
|
+
return [
|
|
178
|
+
...cells,
|
|
179
|
+
...listed("walls"),
|
|
180
|
+
...listed("doors"),
|
|
181
|
+
...(scene.path ? ["path"] : []),
|
|
182
|
+
...(scene.rightLabels ? ["rightLabels"] : []),
|
|
183
|
+
...(scene.bottomLabels ? ["bottomLabels"] : []),
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
/** gridSolver walks a maze or a board of squares: the questions of GridQuestion. */
|
|
187
|
+
export const gridSolver = {
|
|
188
|
+
name: "grid",
|
|
189
|
+
kinds: ["grid"],
|
|
190
|
+
questions: Object.keys(members),
|
|
191
|
+
check,
|
|
192
|
+
facts,
|
|
193
|
+
solve,
|
|
194
|
+
};
|