@altnovatrail/widgets 0.2.0 → 0.3.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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/cores/vector.schema.json +22 -1
  3. package/kinds/cards/cards.handles.json +109 -0
  4. package/kinds/cards/cards.schema.json +483 -0
  5. package/kinds/cards/vectors/any.json +255 -0
  6. package/kinds/cards/vectors/box.json +325 -0
  7. package/kinds/cards/vectors/fork-taps.json +305 -0
  8. package/kinds/cards/vectors/fork.json +254 -0
  9. package/kinds/cards/vectors/invalid-goal.json +70 -0
  10. package/kinds/cards/vectors/invalid-ids.json +113 -0
  11. package/kinds/cards/vectors/invalid-schema.json +88 -0
  12. package/kinds/cards/vectors/invalid-taps.json +214 -0
  13. package/kinds/cards/vectors/key.json +264 -0
  14. package/kinds/cards/vectors/limit.json +274 -0
  15. package/kinds/cards/vectors/no-goal.json +205 -0
  16. package/kinds/cards/vectors/none.json +239 -0
  17. package/kinds/cards/vectors/recog.json +113 -0
  18. package/kinds/cards/vectors/riddle.json +397 -0
  19. package/kinds/cards/vectors/solo.json +218 -0
  20. package/kinds/cells/cells.schema.json +17 -2
  21. package/kinds/line/line.handles.json +195 -0
  22. package/kinds/line/line.schema.json +336 -0
  23. package/kinds/line/vectors/cases.json +213 -0
  24. package/kinds/line/vectors/gaps-12-d1-1.json +140 -0
  25. package/kinds/line/vectors/gaps-12-d1-2.json +95 -0
  26. package/kinds/line/vectors/gaps-12-d1-3.json +122 -0
  27. package/kinds/line/vectors/gaps-12-d1-4.json +121 -0
  28. package/kinds/line/vectors/gaps-12-d1-5.json +87 -0
  29. package/kinds/line/vectors/gaps-12-d2-1.json +173 -0
  30. package/kinds/line/vectors/gaps-12-d2-6.json +87 -0
  31. package/kinds/line/vectors/gaps-12-d3-2.json +173 -0
  32. package/kinds/line/vectors/gaps-12-d4-4.json +168 -0
  33. package/kinds/line/vectors/gaps-12-d5-3.json +99 -0
  34. package/kinds/line/vectors/gaps-12-d5-4.json +215 -0
  35. package/kinds/line/vectors/gaps-34-d1-1.json +37 -0
  36. package/kinds/line/vectors/gaps-34-d1-2.json +130 -0
  37. package/kinds/line/vectors/gaps-34-d1-4.json +155 -0
  38. package/kinds/line/vectors/gaps-34-d1-5.json +43 -0
  39. package/kinds/line/vectors/gaps-34-d3-2.json +38 -0
  40. package/kinds/line/vectors/gaps-34-d3-5.json +177 -0
  41. package/kinds/line/vectors/gaps-34-d5-3.json +39 -0
  42. package/kinds/line/vectors/invalid-line.json +34 -0
  43. package/kinds/line/vectors/invalid-ring.json +34 -0
  44. package/kinds/line/vectors/invalid.json +43 -0
  45. package/kinds/line/vectors/jump-unreachable.json +104 -0
  46. package/kinds/line/vectors/limit.json +40 -0
  47. package/kinds/line/vectors/op-not-in-scene.json +47 -0
  48. package/kinds/line/vectors/ring-cut.json +104 -0
  49. package/kinds/line/vectors/ring-every.json +107 -0
  50. package/kinds/line/vectors/ring-jump.json +135 -0
  51. package/lib/cores/arith.d.ts +62 -0
  52. package/lib/cores/arith.js +197 -0
  53. package/lib/cores/kind.d.ts +31 -3
  54. package/lib/cores/registry.d.ts +43 -0
  55. package/lib/cores/registry.js +87 -0
  56. package/lib/cores/search.d.ts +22 -6
  57. package/lib/cores/search.js +70 -14
  58. package/lib/kinds/cards/goal.d.ts +25 -0
  59. package/lib/kinds/cards/goal.js +72 -0
  60. package/lib/kinds/cards/index.d.ts +14 -0
  61. package/lib/kinds/cards/index.js +17 -0
  62. package/lib/kinds/cards/kind.d.ts +23 -0
  63. package/lib/kinds/cards/kind.js +101 -0
  64. package/lib/kinds/cards/parts.d.ts +36 -0
  65. package/lib/kinds/cards/parts.js +34 -0
  66. package/lib/kinds/cards/scene.d.ts +102 -0
  67. package/lib/kinds/cards/scene.js +356 -0
  68. package/lib/kinds/cards/schema.d.ts +10 -0
  69. package/lib/kinds/cards/schema.js +285 -0
  70. package/lib/kinds/cells/kind.js +11 -64
  71. package/lib/kinds/cells/operation.d.ts +6 -0
  72. package/lib/kinds/cells/polyomino.d.ts +14 -0
  73. package/lib/kinds/cells/polyomino.js +100 -24
  74. package/lib/kinds/cells/registry.js +1 -1
  75. package/lib/kinds/cells/schema.js +3 -1
  76. package/lib/kinds/line/cut.d.ts +2 -0
  77. package/lib/kinds/line/cut.js +63 -0
  78. package/lib/kinds/line/goals.d.ts +22 -0
  79. package/lib/kinds/line/goals.js +137 -0
  80. package/lib/kinds/line/index.d.ts +13 -0
  81. package/lib/kinds/line/index.js +17 -0
  82. package/lib/kinds/line/jump.d.ts +10 -0
  83. package/lib/kinds/line/jump.js +95 -0
  84. package/lib/kinds/line/kind.d.ts +25 -0
  85. package/lib/kinds/line/kind.js +125 -0
  86. package/lib/kinds/line/line.d.ts +63 -0
  87. package/lib/kinds/line/line.js +157 -0
  88. package/lib/kinds/line/operation.d.ts +69 -0
  89. package/lib/kinds/line/operation.js +1 -0
  90. package/lib/kinds/line/posts.d.ts +11 -0
  91. package/lib/kinds/line/posts.js +85 -0
  92. package/lib/kinds/line/registry.d.ts +2 -0
  93. package/lib/kinds/line/registry.js +11 -0
  94. package/lib/kinds/line/schema.d.ts +4 -0
  95. package/lib/kinds/line/schema.js +159 -0
  96. package/package.json +16 -4
  97. package/cores/handles.schema.json +0 -63
@@ -0,0 +1,218 @@
1
+ {
2
+ "description": "The task on one's own of the lesson on signs, the odd one out by every sign but colour: A and E share a hat, B and C spots, and D alone has three legs.",
3
+ "scene": {
4
+ "signs": [
5
+ {
6
+ "id": "colour",
7
+ "label": "colour",
8
+ "values": [
9
+ {
10
+ "id": "blue",
11
+ "label": "blue"
12
+ },
13
+ {
14
+ "id": "pink",
15
+ "label": "pink"
16
+ },
17
+ {
18
+ "id": "yellow",
19
+ "label": "yellow"
20
+ },
21
+ {
22
+ "id": "purple",
23
+ "label": "purple"
24
+ },
25
+ {
26
+ "id": "green",
27
+ "label": "green"
28
+ },
29
+ {
30
+ "id": "orange",
31
+ "label": "orange"
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ "id": "pattern",
37
+ "label": "pattern",
38
+ "values": [
39
+ {
40
+ "id": "plain",
41
+ "label": "plain"
42
+ },
43
+ {
44
+ "id": "stripes",
45
+ "label": "stripes"
46
+ },
47
+ {
48
+ "id": "spots",
49
+ "label": "spots"
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "id": "eyes",
55
+ "label": "eyes",
56
+ "values": [
57
+ {
58
+ "id": "1",
59
+ "label": "one eye"
60
+ },
61
+ {
62
+ "id": "2",
63
+ "label": "two eyes"
64
+ },
65
+ {
66
+ "id": "3",
67
+ "label": "three eyes"
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ "id": "horns",
73
+ "label": "horns",
74
+ "values": [
75
+ {
76
+ "id": "no",
77
+ "label": "no horns"
78
+ },
79
+ {
80
+ "id": "yes",
81
+ "label": "horns"
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "id": "hat",
87
+ "label": "hat",
88
+ "values": [
89
+ {
90
+ "id": "no",
91
+ "label": "no hat"
92
+ },
93
+ {
94
+ "id": "yes",
95
+ "label": "a hat"
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "id": "legs",
101
+ "label": "legs",
102
+ "values": [
103
+ {
104
+ "id": "2",
105
+ "label": "two legs"
106
+ },
107
+ {
108
+ "id": "3",
109
+ "label": "three legs"
110
+ }
111
+ ]
112
+ }
113
+ ],
114
+ "groups": [
115
+ {
116
+ "id": "cards",
117
+ "cards": [
118
+ {
119
+ "id": "A",
120
+ "signs": {
121
+ "colour": "green",
122
+ "pattern": "plain",
123
+ "eyes": "2",
124
+ "horns": "no",
125
+ "hat": "yes",
126
+ "legs": "2"
127
+ }
128
+ },
129
+ {
130
+ "id": "B",
131
+ "signs": {
132
+ "colour": "blue",
133
+ "pattern": "spots",
134
+ "eyes": "2",
135
+ "horns": "no",
136
+ "hat": "no",
137
+ "legs": "2"
138
+ }
139
+ },
140
+ {
141
+ "id": "C",
142
+ "signs": {
143
+ "colour": "pink",
144
+ "pattern": "spots",
145
+ "eyes": "2",
146
+ "horns": "no",
147
+ "hat": "no",
148
+ "legs": "2"
149
+ }
150
+ },
151
+ {
152
+ "id": "D",
153
+ "signs": {
154
+ "colour": "yellow",
155
+ "pattern": "plain",
156
+ "eyes": "2",
157
+ "horns": "no",
158
+ "hat": "no",
159
+ "legs": "3"
160
+ }
161
+ },
162
+ {
163
+ "id": "E",
164
+ "signs": {
165
+ "colour": "purple",
166
+ "pattern": "plain",
167
+ "eyes": "2",
168
+ "horns": "no",
169
+ "hat": "yes",
170
+ "legs": "2"
171
+ }
172
+ }
173
+ ]
174
+ }
175
+ ],
176
+ "goal": {
177
+ "differs": ["pattern", "eyes", "horns", "hat", "legs"]
178
+ }
179
+ },
180
+ "seed": "0",
181
+ "start": {
182
+ "state": {
183
+ "chosen": []
184
+ },
185
+ "goal": false
186
+ },
187
+ "sequences": [],
188
+ "proof": {
189
+ "key": ["D"],
190
+ "asks": "parts",
191
+ "witness": {
192
+ "rule": {
193
+ "differs": ["pattern", "eyes", "horns", "hat", "legs"]
194
+ },
195
+ "rows": [
196
+ {
197
+ "card": "A",
198
+ "same": "E"
199
+ },
200
+ {
201
+ "card": "B",
202
+ "same": "C"
203
+ },
204
+ {
205
+ "card": "C",
206
+ "same": "B"
207
+ },
208
+ {
209
+ "card": "D"
210
+ },
211
+ {
212
+ "card": "E",
213
+ "same": "A"
214
+ }
215
+ ]
216
+ }
217
+ }
218
+ }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://altnovatrail.github.io/widgets/kinds/cells/3.1/cells.schema.json",
3
+ "$id": "https://altnovatrail.github.io/widgets/kinds/cells/3.2/cells.schema.json",
4
4
  "title": "A scene of the widget kind cells",
5
- "description": "A sheet of cells, the operations a learner may play on it with their parameters, and at most one goal a state may meet. Under $defs, a move and a state of the kind.",
5
+ "description": "A sheet of cells, the operations a learner may play on it with their parameters, and at most one goal a state may meet. Under $defs, a move and a state of the kind, and the form of a scene's key.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "sheet": {
@@ -1236,6 +1236,21 @@
1236
1236
  "required": [
1237
1237
  "marks"
1238
1238
  ]
1239
+ },
1240
+ "key": {
1241
+ "description": "The key of a scene, the form of the kind solver's proof: a whole number, whatever the goal asks — the fewest moves, a count, a maximum or a minimum —, or unreachable, where no state meets the goal.",
1242
+ "oneOf": [
1243
+ {
1244
+ "description": "What the goal asks, a whole number.",
1245
+ "type": "integer",
1246
+ "minimum": 0,
1247
+ "maximum": 9007199254740991
1248
+ },
1249
+ {
1250
+ "description": "No state of the scene's state graph meets the goal.",
1251
+ "const": "unreachable"
1252
+ }
1253
+ ]
1239
1254
  }
1240
1255
  }
1241
1256
  }
@@ -0,0 +1,195 @@
1
+ {
2
+ "handles": [
3
+ {
4
+ "name": "highlight",
5
+ "description": "Highlight parts of the widget, by the IDs its parts carry, so that the learner looks there. A highlight stays until clear, until your next reply, or until its part changes.",
6
+ "inputSchema": {
7
+ "description": "The parts to highlight.",
8
+ "type": "object",
9
+ "properties": {
10
+ "parts": {
11
+ "description": "The IDs of the parts, as the widget's parts give them.",
12
+ "type": "array",
13
+ "items": {
14
+ "description": "A part's ID.",
15
+ "type": "string",
16
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$"
17
+ },
18
+ "minItems": 1,
19
+ "uniqueItems": true
20
+ }
21
+ },
22
+ "required": ["parts"],
23
+ "unevaluatedProperties": false
24
+ },
25
+ "class": "show"
26
+ },
27
+ {
28
+ "name": "camera",
29
+ "description": "Turn the widget's camera to frame the parts named, by their IDs, or the whole widget where none are named. The state does not change.",
30
+ "inputSchema": {
31
+ "description": "The parts to frame; none for the whole widget.",
32
+ "type": "object",
33
+ "properties": {
34
+ "parts": {
35
+ "description": "The IDs of the parts, as the widget's parts give them.",
36
+ "type": "array",
37
+ "items": {
38
+ "description": "A part's ID.",
39
+ "type": "string",
40
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$"
41
+ },
42
+ "minItems": 1,
43
+ "uniqueItems": true
44
+ }
45
+ },
46
+ "unevaluatedProperties": false
47
+ },
48
+ "class": "show"
49
+ },
50
+ {
51
+ "name": "clear",
52
+ "description": "Take away every highlight and showing your calls laid on the widget. The state does not change.",
53
+ "inputSchema": {
54
+ "description": "No arguments.",
55
+ "type": "object",
56
+ "unevaluatedProperties": false
57
+ },
58
+ "class": "show"
59
+ },
60
+ {
61
+ "name": "undo",
62
+ "description": "Bring back the widget's state from before its last change: the learner's last move, an earlier call of this reply, or the whole of an earlier reply of yours. Refused where there is no change to undo.",
63
+ "inputSchema": {
64
+ "description": "No arguments.",
65
+ "type": "object",
66
+ "unevaluatedProperties": false
67
+ },
68
+ "class": "rewind"
69
+ },
70
+ {
71
+ "name": "reset",
72
+ "description": "Lay again the state the widget started from: the scene's own, or in a lesson the view of the step shown. The learner can undo it.",
73
+ "inputSchema": {
74
+ "description": "No arguments.",
75
+ "type": "object",
76
+ "unevaluatedProperties": false
77
+ },
78
+ "class": "rewind"
79
+ },
80
+ {
81
+ "name": "post",
82
+ "description": "Put a post on a place of the line, as the learner would by a tap: a tree in a row, a lamp, a stop. Only where the scene allows posts; refused where a post stands there already, or where the line has no such place. The learner can undo it.",
83
+ "inputSchema": {
84
+ "description": "The place to put a post on.",
85
+ "type": "object",
86
+ "properties": {
87
+ "at": {
88
+ "description": "The place, by its number, as the line numbers its places from its first number on.",
89
+ "type": "integer",
90
+ "minimum": 0,
91
+ "maximum": 10000
92
+ }
93
+ },
94
+ "required": ["at"],
95
+ "unevaluatedProperties": false
96
+ },
97
+ "class": "solve"
98
+ },
99
+ {
100
+ "name": "cut",
101
+ "description": "Cut the line at a place, as a saw cuts a log or scissors a ribbon, as the learner would by a stroke across it. Only where the scene allows cuts; refused at an end of an open line, where it is cut already, or where the line has no such place. On an open line each cut adds a piece; on a ring the first cut opens it and leaves one piece. The learner can undo it.",
102
+ "inputSchema": {
103
+ "description": "The place to cut at.",
104
+ "type": "object",
105
+ "properties": {
106
+ "at": {
107
+ "description": "The place, by its number, as the line numbers its places from its first number on.",
108
+ "type": "integer",
109
+ "minimum": 0,
110
+ "maximum": 10000
111
+ }
112
+ },
113
+ "required": ["at"],
114
+ "unevaluatedProperties": false
115
+ },
116
+ "class": "solve"
117
+ },
118
+ {
119
+ "name": "jump",
120
+ "description": "Make the jumper jump its step of places, as the learner would by a jump's button: forward, towards greater numbers, up on an upright line, or back where the scene allows it; round a ring past its last place. Only where the scene has a jumper; refused where the jump would land off an open line, or back where the scene allows none. The learner can undo it.",
121
+ "inputSchema": {
122
+ "description": "Which way to jump.",
123
+ "type": "object",
124
+ "properties": {
125
+ "direction": {
126
+ "description": "\"forward\", towards greater numbers, or \"back\", towards smaller ones.",
127
+ "type": "string",
128
+ "enum": ["forward", "back"]
129
+ }
130
+ },
131
+ "required": ["direction"],
132
+ "unevaluatedProperties": false
133
+ },
134
+ "class": "solve"
135
+ },
136
+ {
137
+ "name": "show_best_path",
138
+ "description": "Show on the line the solver's best path from the state now to the goal — on a maximum or a minimum, to its best —: the places each move acts on, numbered in turn, a jump's on the place it lands on, and the jump's button. It stays while the state is this one, until clear or your next reply. Refused where the scene has no goal.",
139
+ "inputSchema": {
140
+ "description": "No arguments.",
141
+ "type": "object",
142
+ "unevaluatedProperties": false
143
+ },
144
+ "class": "solve"
145
+ },
146
+ {
147
+ "name": "show_outcomes",
148
+ "description": "Mark on the line each move the learner can make now by what it does to the fewest moves left to the goal, as the best path leads: closer, as far, farther, or where the goal — on a maximum or a minimum, its best — can no longer be reached; a post's or a cut's on its place, a jump's on the place it lands on and on its button; a place that several moves act on shows the best of their outcomes, though a tap there puts a post first. It stays while the state is this one, until clear or your next reply. Refused where the scene has no goal.",
149
+ "inputSchema": {
150
+ "description": "No arguments.",
151
+ "type": "object",
152
+ "unevaluatedProperties": false
153
+ },
154
+ "class": "solve"
155
+ },
156
+ {
157
+ "name": "show_distance",
158
+ "description": "Say in the widget's bar the fewest moves left from the state now to the goal, as the best path leads, or that it can no longer be reached; on a maximum or a minimum whose best can no longer be reached, that the goal is met, or can still be met, short of its best. It stays while the state is this one, until clear or your next reply. Refused where the scene has no goal.",
159
+ "inputSchema": {
160
+ "description": "No arguments.",
161
+ "type": "object",
162
+ "unevaluatedProperties": false
163
+ },
164
+ "class": "solve"
165
+ },
166
+ {
167
+ "name": "show_graph",
168
+ "description": "Say in the widget's bar how many states each count of moves from the scene's start reaches, the layer of the state now marked. It stays while the state is this one, until clear or your next reply. Refused where the scene has no goal.",
169
+ "inputSchema": {
170
+ "description": "No arguments.",
171
+ "type": "object",
172
+ "unevaluatedProperties": false
173
+ },
174
+ "class": "solve"
175
+ },
176
+ {
177
+ "name": "show_count",
178
+ "description": "Number the posts, or the gaps between neighbouring posts, one by one along the line from 1, on a ring the gap round past the last post last, so that the learner counts them with you: they are what the widget's counters of posts and gaps count, and an open line has one gap fewer than posts, a ring as many. The numbers follow the posts as they change and stay until clear or your next reply. The state does not change.",
179
+ "inputSchema": {
180
+ "description": "What to count.",
181
+ "type": "object",
182
+ "properties": {
183
+ "of": {
184
+ "description": "The posts, \"posts\", or the gaps between neighbouring posts, \"gaps\".",
185
+ "type": "string",
186
+ "enum": ["posts", "gaps"]
187
+ }
188
+ },
189
+ "required": ["of"],
190
+ "unevaluatedProperties": false
191
+ },
192
+ "class": "show"
193
+ }
194
+ ]
195
+ }