@altnovatrail/widgets 0.1.1 → 0.1.3
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 +1 -1
- package/cores/vector.schema.json +82 -3
- package/kinds/cells/cells.handles.json +145 -0
- package/kinds/cells/cells.schema.json +652 -4
- package/kinds/cells/vectors/bishop-grid-56-d1-1.json +105 -4
- package/kinds/cells/vectors/counter-cases.json +123 -0
- package/kinds/cells/vectors/counter-div-56-d1-3.json +57 -0
- package/kinds/cells/vectors/counter-div-56-d2-1.json +773 -0
- package/kinds/cells/vectors/counter-div-56-d2-3.json +65 -0
- package/kinds/cells/vectors/counter-div-56-d4-1.json +57 -0
- package/kinds/cells/vectors/counter-div-56-d4-2.json +106 -0
- package/kinds/cells/vectors/cut-cases.json +163 -0
- package/kinds/cells/vectors/cut-gaps-56-d2-1.json +142 -0
- package/kinds/cells/vectors/cut-grid-56-d2-4.json +45 -0
- package/kinds/cells/vectors/cut-grid-56-d4-1.json +154 -0
- package/kinds/cells/vectors/cut-grid-56-d4-2.json +136 -0
- package/kinds/cells/vectors/cut-invalid.json +48 -0
- package/kinds/cells/vectors/domino-grid-56-d3-2.json +238 -0
- package/kinds/cells/vectors/domino-limit.json +60 -0
- package/kinds/cells/vectors/domino-par-56-d3-2.json +194 -0
- package/kinds/cells/vectors/domino-par-56-d4-3.json +127 -0
- package/kinds/cells/vectors/figure-apart.json +47 -0
- package/kinds/cells/vectors/fold-12x12.json +79 -0
- package/kinds/cells/vectors/fold-14x14.json +79 -0
- package/kinds/cells/vectors/fold-26x26.json +79 -0
- package/kinds/cells/vectors/garden-enum-56-d3-4.json +96 -6
- package/kinds/cells/vectors/goat-grid-56-d4-4.json +325 -5
- package/kinds/cells/vectors/mosaic-grid-56-d2-2.json +84 -0
- package/kinds/cells/vectors/nodes-gaps-56-d2-2.json +44 -0
- package/kinds/cells/vectors/nodes-gaps-56-d4-2.json +70 -0
- package/kinds/cells/vectors/number-div-56-d2-2.json +49 -0
- package/kinds/cells/vectors/numbers-div-56-d3-1.json +24 -0
- package/kinds/cells/vectors/numbers-invalid.json +56 -0
- package/kinds/cells/vectors/paper-26x26.json +743 -0
- package/kinds/cells/vectors/paper-cube-12-d2-1.json +43 -19
- package/kinds/cells/vectors/paper-cube-12-d5-1.json +47 -4
- package/kinds/cells/vectors/paper-cube-56-d4-1.json +56 -5
- package/kinds/cells/vectors/paper-drawn-lines.json +149 -0
- package/kinds/cells/vectors/paper-grid-56-d1-2.json +46 -5
- package/kinds/cells/vectors/paper-turn-invalid.json +4 -4
- package/kinds/cells/vectors/path-6x6.json +119 -0
- package/kinds/cells/vectors/path-beside.json +108 -0
- package/kinds/cells/vectors/path-enum-12-d3-5.json +187 -0
- package/kinds/cells/vectors/path-enum-34-d4-3.json +412 -0
- package/kinds/cells/vectors/path-enum-56-d3-3.json +411 -0
- package/kinds/cells/vectors/path-enum-56-d3-5.json +351 -0
- package/kinds/cells/vectors/path-invalid.json +37 -0
- package/kinds/cells/vectors/path-limit.json +58 -0
- package/kinds/cells/vectors/path-maze.json +297 -0
- package/kinds/cells/vectors/path-unreachable.json +76 -0
- package/kinds/cells/vectors/perimeter-grid-56-d2-1.json +86 -0
- package/kinds/cells/vectors/perimeter-grid-56-d3-1.json +102 -0
- package/kinds/cells/vectors/perimeter-grid-56-d3-3.json +112 -0
- package/kinds/cells/vectors/perimeter-grid-56-d4-3.json +289 -0
- package/kinds/cells/vectors/polyomino-cases.json +191 -0
- package/kinds/cells/vectors/polyomino-grid-56-d3-4.json +205 -0
- package/kinds/cells/vectors/polyomino-grid-56-d4-1.json +137 -0
- package/kinds/cells/vectors/polyomino-grid-56-d5-3.json +157 -0
- package/kinds/cells/vectors/polyomino-invalid.json +45 -0
- package/kinds/cells/vectors/route-par-56-d3-3.json +245 -0
- package/kinds/cells/vectors/sides-gaps-56-d3-2.json +44 -0
- package/kinds/cells/vectors/sieve-div-56-d3-2.json +140 -0
- package/kinds/cells/vectors/tear-gaps-56-d3-1.json +84 -0
- package/kinds/cells/vectors/tear-limit.json +56 -0
- package/lib/cores/enumerate.d.ts +33 -0
- package/lib/cores/enumerate.js +77 -0
- package/lib/cores/kind.d.ts +55 -5
- package/lib/cores/search.d.ts +27 -8
- package/lib/cores/search.js +85 -28
- package/lib/kinds/cells/bishop.d.ts +1 -1
- package/lib/kinds/cells/bishop.js +1 -1
- package/lib/kinds/cells/counter.d.ts +26 -0
- package/lib/kinds/cells/counter.js +249 -0
- package/lib/kinds/cells/cut.d.ts +46 -0
- package/lib/kinds/cells/cut.js +400 -0
- package/lib/kinds/cells/figure.d.ts +13 -0
- package/lib/kinds/cells/figure.js +114 -0
- package/lib/kinds/cells/holes.d.ts +6 -0
- package/lib/kinds/cells/holes.js +57 -0
- package/lib/kinds/cells/kind.js +4 -2
- package/lib/kinds/cells/number.d.ts +6 -0
- package/lib/kinds/cells/number.js +32 -0
- package/lib/kinds/cells/operation.d.ts +12 -6
- package/lib/kinds/cells/paper.d.ts +10 -2
- package/lib/kinds/cells/paper.js +90 -8
- package/lib/kinds/cells/path.d.ts +38 -0
- package/lib/kinds/cells/path.js +288 -0
- package/lib/kinds/cells/piece.d.ts +10 -1
- package/lib/kinds/cells/piece.js +87 -3
- package/lib/kinds/cells/polyomino.d.ts +45 -0
- package/lib/kinds/cells/polyomino.js +450 -0
- package/lib/kinds/cells/registry.js +35 -4
- package/lib/kinds/cells/schema.js +41 -3
- package/lib/kinds/cells/sheet.d.ts +20 -1
- package/lib/kinds/cells/sheet.js +84 -6
- package/lib/kinds/cells/side.d.ts +33 -0
- package/lib/kinds/cells/side.js +86 -0
- package/lib/kinds/cells/sieve.d.ts +26 -0
- package/lib/kinds/cells/sieve.js +208 -0
- package/lib/kinds/cells/step.d.ts +1 -1
- package/lib/kinds/cells/step.js +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -19,6 +19,6 @@ A component of [NovaTrail](https://github.com/altnovatrail/spec), a universal op
|
|
|
19
19
|
|
|
20
20
|
Its widgets run in `app` through the widget host of `canvas`, in an iframe sandbox with no network; each kind has a scene schema and a solver of its own; `modules` takes its bundles at a tag and pins each by its hash, and proves each scene's key with the kinds' solvers, an npm package of the same release.
|
|
21
21
|
|
|
22
|
-
Its design is detailed, and its first widget kind, the sheet of cells, is built: its rules and solver on the
|
|
22
|
+
Its design is detailed, and its first widget kind, the sheet of cells, is built: folds and paint, pieces on a board, paper folded in layers and punched, a table of numbers, paths, cuts and polyominoes; its rules and solver on the cores of search over states and of enumeration, which prove the fewest moves to a goal, a count, a maximum or a minimum, with their scene vectors, as an npm package checked the way a module's build takes it; its drawing — the sheet in perspective on a canvas, seen on the table or from above, as the learner switches —, bundled as one HTML file; the shell every kind shares; and the test host that plays it in the engines of Chromium, WebKit and Firefox. A release carries the bundle, its handles, the npm package and the list of withdrawn bundles; the releases are published, the package in npm by trusted publishing.
|
|
23
23
|
|
|
24
24
|
Its card is in the architecture of [spec](https://github.com/altnovatrail/spec); its own documents, its decisions and its plan are in [docs/](docs/README.md).
|
package/cores/vector.schema.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://altnovatrail.github.io/widgets/cores/1.
|
|
3
|
+
"$id": "https://altnovatrail.github.io/widgets/cores/1.1/vector.schema.json",
|
|
4
4
|
"title": "A scene vector of a widget kind",
|
|
5
5
|
"description": "A scene of a kind, the seed of the widget, sequences of moves from the scene with the state each move leads to and whether it meets the scene's goal, and the proof the kind's solver gives. Written by hand in kinds/<kind>/vectors/, and passed by the kind's rules and solver on every change.",
|
|
6
6
|
"type": "object",
|
|
@@ -89,10 +89,89 @@
|
|
|
89
89
|
"maxItems": 1
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
|
-
"required": ["key", "witness", "ends"]
|
|
92
|
+
"required": ["key", "witness", "ends"],
|
|
93
|
+
"not": {
|
|
94
|
+
"properties": {
|
|
95
|
+
"asks": { "description": "What the key is, which the fewest moves never name." }
|
|
96
|
+
},
|
|
97
|
+
"required": ["asks"]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"description": "How many states meet the goal, the first of each class where the scene gives symmetries, a path to each, and the states counted, in the graph's order.",
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"key": {
|
|
105
|
+
"description": "How many states meet the goal.",
|
|
106
|
+
"type": "integer",
|
|
107
|
+
"minimum": 1
|
|
108
|
+
},
|
|
109
|
+
"asks": { "description": "The key is a count of states.", "const": "count" },
|
|
110
|
+
"witness": {
|
|
111
|
+
"description": "A path of the fewest moves to each state counted, in the order of the ends, as many as the key counts.",
|
|
112
|
+
"type": "object",
|
|
113
|
+
"properties": {
|
|
114
|
+
"paths": {
|
|
115
|
+
"description": "The paths, each the moves in order.",
|
|
116
|
+
"type": "array",
|
|
117
|
+
"items": { "description": "A path.", "type": "array" },
|
|
118
|
+
"minItems": 1
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"required": ["paths"],
|
|
122
|
+
"unevaluatedProperties": false
|
|
123
|
+
},
|
|
124
|
+
"ends": {
|
|
125
|
+
"description": "The states counted, each meeting the goal.",
|
|
126
|
+
"type": "array",
|
|
127
|
+
"minItems": 1
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"required": ["key", "asks", "witness", "ends"]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"description": "How many ways of the fewest moves reach the goal, or the greatest or least measure of a state that meets it; the first such way, or the path to the first state of that measure, and the state it ends in.",
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"key": {
|
|
137
|
+
"description": "The count of ways, a whole number from 1, or the measure.",
|
|
138
|
+
"type": "integer"
|
|
139
|
+
},
|
|
140
|
+
"asks": {
|
|
141
|
+
"description": "What the key is: a count of ways, a maximum or a minimum.",
|
|
142
|
+
"enum": ["paths", "max", "min"]
|
|
143
|
+
},
|
|
144
|
+
"witness": {
|
|
145
|
+
"description": "The first way counted, or the path to the first state of the measure.",
|
|
146
|
+
"type": "object",
|
|
147
|
+
"properties": {
|
|
148
|
+
"path": {
|
|
149
|
+
"description": "The moves of the path, in order.",
|
|
150
|
+
"type": "array"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": ["path"],
|
|
154
|
+
"unevaluatedProperties": false
|
|
155
|
+
},
|
|
156
|
+
"ends": {
|
|
157
|
+
"description": "The state the path ends in, which meets the goal.",
|
|
158
|
+
"type": "array",
|
|
159
|
+
"minItems": 1,
|
|
160
|
+
"maxItems": 1
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"required": ["key", "asks", "witness", "ends"],
|
|
164
|
+
"if": {
|
|
165
|
+
"properties": { "asks": { "description": "A count of ways.", "const": "paths" } }
|
|
166
|
+
},
|
|
167
|
+
"then": {
|
|
168
|
+
"properties": {
|
|
169
|
+
"key": { "description": "A count of ways is a whole number from 1.", "minimum": 1 }
|
|
170
|
+
}
|
|
171
|
+
}
|
|
93
172
|
},
|
|
94
173
|
{
|
|
95
|
-
"description": "The goal cannot be met: the whole state graph, which no state of it meets, given by the count of states in each layer.",
|
|
174
|
+
"description": "The goal cannot be met, whatever it asks: the whole state graph, which no state of it meets, given by the count of states in each layer.",
|
|
96
175
|
"type": "object",
|
|
97
176
|
"properties": {
|
|
98
177
|
"key": { "description": "The goal cannot be met.", "const": "unreachable" },
|
|
@@ -167,6 +167,121 @@
|
|
|
167
167
|
},
|
|
168
168
|
"class": "solve"
|
|
169
169
|
},
|
|
170
|
+
{
|
|
171
|
+
"name": "counter",
|
|
172
|
+
"description": "Move the counter of a table of numbers on or back by one of the scene's steps, to the cell it lands on, as the learner would: past a row's end it goes on into the next row. Only where the scene has a counter; refused where the rules refuse the move. The learner can undo it.",
|
|
173
|
+
"inputSchema": {
|
|
174
|
+
"description": "Where the counter goes.",
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"to": {
|
|
178
|
+
"description": "The cell it goes to, named by its row's letter from the top and its column's number from the left, as \"B3\".",
|
|
179
|
+
"type": "string",
|
|
180
|
+
"pattern": "^[A-Z]([1-9]|1[0-9]|2[0-6])$"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"required": ["to"],
|
|
184
|
+
"unevaluatedProperties": false
|
|
185
|
+
},
|
|
186
|
+
"class": "solve"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "sieve",
|
|
190
|
+
"description": "Count out the numbers of a table of numbers by one of the scene's widths, crossing out each number whose remainder by it is not the one the scene leaves, as the learner would. Only where the scene has a sieve; refused where the width is not the scene's or was counted out already. The learner can undo it.",
|
|
191
|
+
"inputSchema": {
|
|
192
|
+
"description": "The width counted out by.",
|
|
193
|
+
"type": "object",
|
|
194
|
+
"properties": {
|
|
195
|
+
"by": {
|
|
196
|
+
"description": "The width, one the scene gives.",
|
|
197
|
+
"type": "integer",
|
|
198
|
+
"minimum": 2,
|
|
199
|
+
"maximum": 10674
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"required": ["by"],
|
|
203
|
+
"unevaluatedProperties": false
|
|
204
|
+
},
|
|
205
|
+
"class": "solve"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "path",
|
|
209
|
+
"description": "Draw the path one step on, onto a cell beside its last one, as the learner would; a step back onto its first cell closes it into a route. Only where the scene allows a path; refused where the step goes in a direction the scene does not allow, into a hole, through a wall, onto a cell the path has visited, or on from a closed route. The learner can undo it.",
|
|
210
|
+
"inputSchema": {
|
|
211
|
+
"description": "Where the path steps.",
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"to": {
|
|
215
|
+
"description": "The cell it steps onto, named by its row's letter from the top and its column's number from the left, as \"B3\".",
|
|
216
|
+
"type": "string",
|
|
217
|
+
"pattern": "^[A-Z]([1-9]|1[0-9]|2[0-6])$"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"required": ["to"],
|
|
221
|
+
"unevaluatedProperties": false
|
|
222
|
+
},
|
|
223
|
+
"class": "solve"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "cut",
|
|
227
|
+
"description": "Cut from a side between two cells, as the learner would: the side alone, along its line through the part it lies in, or along its whole line, as the scene runs a cut. Only where the scene allows cuts; refused where the side is on the sheet's edge, beside a hole, a wall, or cut already. The learner can undo it.",
|
|
228
|
+
"inputSchema": {
|
|
229
|
+
"description": "Where the cut starts.",
|
|
230
|
+
"type": "object",
|
|
231
|
+
"properties": {
|
|
232
|
+
"side": {
|
|
233
|
+
"description": "The side between two cells, by its line and the row or column it lies beside: \"v2:B\" between B2 and B3, \"h1:3\" between A3 and B3; v2 is the line between the columns 2 and 3, h1 the line between the rows A and B.",
|
|
234
|
+
"type": "string",
|
|
235
|
+
"pattern": "^(v(0|[1-9]|1[0-9]|2[0-6]):[A-Z]|h(0|[1-9]|1[0-9]|2[0-6]):([1-9]|1[0-9]|2[0-6]))$"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"required": ["side"],
|
|
239
|
+
"unevaluatedProperties": false
|
|
240
|
+
},
|
|
241
|
+
"class": "solve"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "polyomino_lay",
|
|
245
|
+
"description": "Lay a figure on the cells it covers, as the learner would: one of the scene's shapes, turned or turned over only as the scene allows, or any shape of the scene's count of cells joined by their sides. Only where the scene allows figures; refused on a hole, over another figure, for cells of no shape the scene gives, or once as many figures lie as the scene has. The learner can undo it.",
|
|
246
|
+
"inputSchema": {
|
|
247
|
+
"description": "The cells the figure covers.",
|
|
248
|
+
"type": "object",
|
|
249
|
+
"properties": {
|
|
250
|
+
"cells": {
|
|
251
|
+
"description": "The cells, in any order, each named by its row's letter from the top and its column's number from the left, as \"B3\".",
|
|
252
|
+
"type": "array",
|
|
253
|
+
"items": {
|
|
254
|
+
"description": "A cell the figure covers.",
|
|
255
|
+
"type": "string",
|
|
256
|
+
"pattern": "^[A-Z]([1-9]|1[0-9]|2[0-6])$"
|
|
257
|
+
},
|
|
258
|
+
"minItems": 1,
|
|
259
|
+
"uniqueItems": true
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"required": ["cells"],
|
|
263
|
+
"unevaluatedProperties": false
|
|
264
|
+
},
|
|
265
|
+
"class": "solve"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "polyomino_lift",
|
|
269
|
+
"description": "Lift a figure off the sheet, as the learner would, so that it may be laid again elsewhere. Only where the scene allows figures; refused where no figure covers the cell. The learner can undo it.",
|
|
270
|
+
"inputSchema": {
|
|
271
|
+
"description": "A cell the figure covers.",
|
|
272
|
+
"type": "object",
|
|
273
|
+
"properties": {
|
|
274
|
+
"cell": {
|
|
275
|
+
"description": "The cell, named by its row's letter from the top and its column's number from the left, as \"B3\".",
|
|
276
|
+
"type": "string",
|
|
277
|
+
"pattern": "^[A-Z]([1-9]|1[0-9]|2[0-6])$"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"required": ["cell"],
|
|
281
|
+
"unevaluatedProperties": false
|
|
282
|
+
},
|
|
283
|
+
"class": "solve"
|
|
284
|
+
},
|
|
170
285
|
{
|
|
171
286
|
"name": "paper_fold",
|
|
172
287
|
"description": "Fold the paper over in layers along a line of its grid, laying the part on one side over the other, as the learner would. Only where the scene allows paper, before its punch; refused where the line is off the paper or the part laid over is wider than the other. The learner can undo it.",
|
|
@@ -256,6 +371,36 @@
|
|
|
256
371
|
"unevaluatedProperties": false
|
|
257
372
|
},
|
|
258
373
|
"class": "show"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"name": "turn_camera",
|
|
377
|
+
"description": "Turn the camera around the sheet, smoothly, so that the learner sees it from another side or from higher or lower: to one of its two places, on the table, a little west of the sheet's last row and high over it, or straight above the sheet; or to an azimuth and an elevation. What is not given is kept from where the camera stands, or from the place given. The camera stays where it is turned until the learner or you turn it again; the learner turns it by a drag begun off the sheet, and the switch in the bar brings it back to its place. The state does not change.",
|
|
378
|
+
"inputSchema": {
|
|
379
|
+
"description": "Where the camera goes: a place, an azimuth, an elevation, or a place with either angle.",
|
|
380
|
+
"type": "object",
|
|
381
|
+
"properties": {
|
|
382
|
+
"place": {
|
|
383
|
+
"description": "One of the camera's two places, \"table\" or \"above\".",
|
|
384
|
+
"type": "string",
|
|
385
|
+
"enum": ["table", "above"]
|
|
386
|
+
},
|
|
387
|
+
"azimuth": {
|
|
388
|
+
"description": "The side the camera looks from, in degrees: 0 from the side of the sheet's last row, 90 from the side of its last column, -90 from the side of its first column, 180 from the side of its first row.",
|
|
389
|
+
"type": "number",
|
|
390
|
+
"minimum": -180,
|
|
391
|
+
"maximum": 180
|
|
392
|
+
},
|
|
393
|
+
"elevation": {
|
|
394
|
+
"description": "The camera's height over the table, in degrees: 20 low beside the sheet, 90 straight above it.",
|
|
395
|
+
"type": "number",
|
|
396
|
+
"minimum": 20,
|
|
397
|
+
"maximum": 90
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"minProperties": 1,
|
|
401
|
+
"unevaluatedProperties": false
|
|
402
|
+
},
|
|
403
|
+
"class": "show"
|
|
259
404
|
}
|
|
260
405
|
]
|
|
261
406
|
}
|