@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.
- package/README.md +1 -1
- package/cores/vector.schema.json +22 -1
- package/kinds/cards/cards.handles.json +109 -0
- package/kinds/cards/cards.schema.json +483 -0
- package/kinds/cards/vectors/any.json +255 -0
- package/kinds/cards/vectors/box.json +325 -0
- package/kinds/cards/vectors/fork-taps.json +305 -0
- package/kinds/cards/vectors/fork.json +254 -0
- package/kinds/cards/vectors/invalid-goal.json +70 -0
- package/kinds/cards/vectors/invalid-ids.json +113 -0
- package/kinds/cards/vectors/invalid-schema.json +88 -0
- package/kinds/cards/vectors/invalid-taps.json +214 -0
- package/kinds/cards/vectors/key.json +264 -0
- package/kinds/cards/vectors/limit.json +274 -0
- package/kinds/cards/vectors/no-goal.json +205 -0
- package/kinds/cards/vectors/none.json +239 -0
- package/kinds/cards/vectors/recog.json +113 -0
- package/kinds/cards/vectors/riddle.json +397 -0
- package/kinds/cards/vectors/solo.json +218 -0
- package/kinds/cells/cells.schema.json +17 -2
- package/kinds/line/line.handles.json +195 -0
- package/kinds/line/line.schema.json +336 -0
- package/kinds/line/vectors/cases.json +213 -0
- package/kinds/line/vectors/gaps-12-d1-1.json +140 -0
- package/kinds/line/vectors/gaps-12-d1-2.json +95 -0
- package/kinds/line/vectors/gaps-12-d1-3.json +122 -0
- package/kinds/line/vectors/gaps-12-d1-4.json +121 -0
- package/kinds/line/vectors/gaps-12-d1-5.json +87 -0
- package/kinds/line/vectors/gaps-12-d2-1.json +173 -0
- package/kinds/line/vectors/gaps-12-d2-6.json +87 -0
- package/kinds/line/vectors/gaps-12-d3-2.json +173 -0
- package/kinds/line/vectors/gaps-12-d4-4.json +168 -0
- package/kinds/line/vectors/gaps-12-d5-3.json +99 -0
- package/kinds/line/vectors/gaps-12-d5-4.json +215 -0
- package/kinds/line/vectors/gaps-34-d1-1.json +37 -0
- package/kinds/line/vectors/gaps-34-d1-2.json +130 -0
- package/kinds/line/vectors/gaps-34-d1-4.json +155 -0
- package/kinds/line/vectors/gaps-34-d1-5.json +43 -0
- package/kinds/line/vectors/gaps-34-d3-2.json +38 -0
- package/kinds/line/vectors/gaps-34-d3-5.json +177 -0
- package/kinds/line/vectors/gaps-34-d5-3.json +39 -0
- package/kinds/line/vectors/invalid-line.json +34 -0
- package/kinds/line/vectors/invalid-ring.json +34 -0
- package/kinds/line/vectors/invalid.json +43 -0
- package/kinds/line/vectors/jump-unreachable.json +104 -0
- package/kinds/line/vectors/limit.json +40 -0
- package/kinds/line/vectors/op-not-in-scene.json +47 -0
- package/kinds/line/vectors/ring-cut.json +104 -0
- package/kinds/line/vectors/ring-every.json +107 -0
- package/kinds/line/vectors/ring-jump.json +135 -0
- package/lib/cores/arith.d.ts +62 -0
- package/lib/cores/arith.js +197 -0
- package/lib/cores/kind.d.ts +31 -3
- package/lib/cores/registry.d.ts +43 -0
- package/lib/cores/registry.js +87 -0
- package/lib/cores/search.d.ts +22 -6
- package/lib/cores/search.js +70 -14
- package/lib/kinds/cards/goal.d.ts +25 -0
- package/lib/kinds/cards/goal.js +72 -0
- package/lib/kinds/cards/index.d.ts +14 -0
- package/lib/kinds/cards/index.js +17 -0
- package/lib/kinds/cards/kind.d.ts +23 -0
- package/lib/kinds/cards/kind.js +101 -0
- package/lib/kinds/cards/parts.d.ts +36 -0
- package/lib/kinds/cards/parts.js +34 -0
- package/lib/kinds/cards/scene.d.ts +102 -0
- package/lib/kinds/cards/scene.js +356 -0
- package/lib/kinds/cards/schema.d.ts +10 -0
- package/lib/kinds/cards/schema.js +285 -0
- package/lib/kinds/cells/kind.js +11 -64
- package/lib/kinds/cells/operation.d.ts +6 -0
- package/lib/kinds/cells/polyomino.d.ts +14 -0
- package/lib/kinds/cells/polyomino.js +100 -24
- package/lib/kinds/cells/registry.js +1 -1
- package/lib/kinds/cells/schema.js +3 -1
- package/lib/kinds/line/cut.d.ts +2 -0
- package/lib/kinds/line/cut.js +63 -0
- package/lib/kinds/line/goals.d.ts +22 -0
- package/lib/kinds/line/goals.js +137 -0
- package/lib/kinds/line/index.d.ts +13 -0
- package/lib/kinds/line/index.js +17 -0
- package/lib/kinds/line/jump.d.ts +10 -0
- package/lib/kinds/line/jump.js +95 -0
- package/lib/kinds/line/kind.d.ts +25 -0
- package/lib/kinds/line/kind.js +125 -0
- package/lib/kinds/line/line.d.ts +63 -0
- package/lib/kinds/line/line.js +157 -0
- package/lib/kinds/line/operation.d.ts +69 -0
- package/lib/kinds/line/operation.js +1 -0
- package/lib/kinds/line/posts.d.ts +11 -0
- package/lib/kinds/line/posts.js +85 -0
- package/lib/kinds/line/registry.d.ts +2 -0
- package/lib/kinds/line/registry.js +11 -0
- package/lib/kinds/line/schema.d.ts +4 -0
- package/lib/kinds/line/schema.js +159 -0
- package/package.json +16 -4
- package/cores/handles.schema.json +0 -63
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A jumper of two places that may jump back, from stone 1 of 9, never lands on stone 8: its places are the odd ones, and the key is unreachable, its graph five places in a row. A jump back from stone 1 and one forward from stone 9 would leave the line.",
|
|
3
|
+
"scene": {
|
|
4
|
+
"line": {
|
|
5
|
+
"places": 9,
|
|
6
|
+
"first": 1
|
|
7
|
+
},
|
|
8
|
+
"operations": {
|
|
9
|
+
"jump": {
|
|
10
|
+
"from": 1,
|
|
11
|
+
"step": 2,
|
|
12
|
+
"back": true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"goal": {
|
|
16
|
+
"counters": {
|
|
17
|
+
"is": {
|
|
18
|
+
"at": 8
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"seed": "0",
|
|
24
|
+
"start": {
|
|
25
|
+
"state": {
|
|
26
|
+
"posts": [],
|
|
27
|
+
"at": 1
|
|
28
|
+
},
|
|
29
|
+
"goal": false
|
|
30
|
+
},
|
|
31
|
+
"sequences": [
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
"move": {
|
|
35
|
+
"jump": "back"
|
|
36
|
+
},
|
|
37
|
+
"refused": "off-line"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"move": {
|
|
41
|
+
"jump": "forward"
|
|
42
|
+
},
|
|
43
|
+
"state": {
|
|
44
|
+
"posts": [],
|
|
45
|
+
"at": 3
|
|
46
|
+
},
|
|
47
|
+
"goal": false
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"move": {
|
|
51
|
+
"jump": "forward"
|
|
52
|
+
},
|
|
53
|
+
"state": {
|
|
54
|
+
"posts": [],
|
|
55
|
+
"at": 5
|
|
56
|
+
},
|
|
57
|
+
"goal": false
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"move": {
|
|
61
|
+
"jump": "forward"
|
|
62
|
+
},
|
|
63
|
+
"state": {
|
|
64
|
+
"posts": [],
|
|
65
|
+
"at": 7
|
|
66
|
+
},
|
|
67
|
+
"goal": false
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"move": {
|
|
71
|
+
"jump": "forward"
|
|
72
|
+
},
|
|
73
|
+
"state": {
|
|
74
|
+
"posts": [],
|
|
75
|
+
"at": 9
|
|
76
|
+
},
|
|
77
|
+
"goal": false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"move": {
|
|
81
|
+
"jump": "forward"
|
|
82
|
+
},
|
|
83
|
+
"refused": "off-line"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"move": {
|
|
87
|
+
"jump": "back"
|
|
88
|
+
},
|
|
89
|
+
"state": {
|
|
90
|
+
"posts": [],
|
|
91
|
+
"at": 7
|
|
92
|
+
},
|
|
93
|
+
"goal": false
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
],
|
|
97
|
+
"proof": {
|
|
98
|
+
"key": "unreachable",
|
|
99
|
+
"witness": {
|
|
100
|
+
"layers": [1, 1, 1, 1, 1]
|
|
101
|
+
},
|
|
102
|
+
"ends": []
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Posts on twelve free places, a post on every one the goal: the 4,096 sets of posts pass the kind's limit of 3,000 states, and the scene does not decide.",
|
|
3
|
+
"scene": {
|
|
4
|
+
"line": {
|
|
5
|
+
"places": 12,
|
|
6
|
+
"first": 1
|
|
7
|
+
},
|
|
8
|
+
"operations": {
|
|
9
|
+
"post": {}
|
|
10
|
+
},
|
|
11
|
+
"goal": {
|
|
12
|
+
"every": {}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"seed": "0",
|
|
16
|
+
"start": {
|
|
17
|
+
"state": {
|
|
18
|
+
"posts": []
|
|
19
|
+
},
|
|
20
|
+
"goal": false
|
|
21
|
+
},
|
|
22
|
+
"sequences": [
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
"move": {
|
|
26
|
+
"post": {
|
|
27
|
+
"at": 12
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"state": {
|
|
31
|
+
"posts": [12]
|
|
32
|
+
},
|
|
33
|
+
"goal": false
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
],
|
|
37
|
+
"proof": {
|
|
38
|
+
"undecided": "limit"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A line only to look at, with its posts and no goal: a move of an operation the kind has but the scene does not allow is refused, and the scene has nothing to prove.",
|
|
3
|
+
"scene": {
|
|
4
|
+
"line": {
|
|
5
|
+
"places": 4,
|
|
6
|
+
"first": 1,
|
|
7
|
+
"posts": [1, 4]
|
|
8
|
+
},
|
|
9
|
+
"operations": {}
|
|
10
|
+
},
|
|
11
|
+
"seed": "0",
|
|
12
|
+
"start": {
|
|
13
|
+
"state": {
|
|
14
|
+
"posts": [1, 4]
|
|
15
|
+
},
|
|
16
|
+
"goal": false
|
|
17
|
+
},
|
|
18
|
+
"sequences": [
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
"move": {
|
|
22
|
+
"post": {
|
|
23
|
+
"at": 2
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"refused": "op-not-in-scene"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"move": {
|
|
30
|
+
"cut": {
|
|
31
|
+
"at": 2
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"refused": "op-not-in-scene"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"move": {
|
|
38
|
+
"jump": "forward"
|
|
39
|
+
},
|
|
40
|
+
"refused": "op-not-in-scene"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
],
|
|
44
|
+
"proof": {
|
|
45
|
+
"undecided": "no-goal"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A ring of six places, a necklace, cut into three pieces: it has no end, so a cut at any place is taken, the first opens it into one piece, and the fewest cuts that leave three pieces are 3, as many as the pieces. A cut where the ring is cut already is refused.",
|
|
3
|
+
"scene": {
|
|
4
|
+
"line": {
|
|
5
|
+
"places": 6,
|
|
6
|
+
"first": 1,
|
|
7
|
+
"closed": true
|
|
8
|
+
},
|
|
9
|
+
"operations": {
|
|
10
|
+
"cut": {}
|
|
11
|
+
},
|
|
12
|
+
"goal": {
|
|
13
|
+
"counters": {
|
|
14
|
+
"is": {
|
|
15
|
+
"pieces": 3
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"seed": "0",
|
|
21
|
+
"start": {
|
|
22
|
+
"state": {
|
|
23
|
+
"posts": [],
|
|
24
|
+
"cuts": []
|
|
25
|
+
},
|
|
26
|
+
"goal": false
|
|
27
|
+
},
|
|
28
|
+
"sequences": [
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"move": {
|
|
32
|
+
"cut": {
|
|
33
|
+
"at": 1
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"state": {
|
|
37
|
+
"posts": [],
|
|
38
|
+
"cuts": [1]
|
|
39
|
+
},
|
|
40
|
+
"goal": false
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"move": {
|
|
44
|
+
"cut": {
|
|
45
|
+
"at": 1
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"refused": "cut"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"move": {
|
|
52
|
+
"cut": {
|
|
53
|
+
"at": 6
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"state": {
|
|
57
|
+
"posts": [],
|
|
58
|
+
"cuts": [1, 6]
|
|
59
|
+
},
|
|
60
|
+
"goal": false
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"move": {
|
|
64
|
+
"cut": {
|
|
65
|
+
"at": 3
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"state": {
|
|
69
|
+
"posts": [],
|
|
70
|
+
"cuts": [1, 3, 6]
|
|
71
|
+
},
|
|
72
|
+
"goal": true
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
],
|
|
76
|
+
"proof": {
|
|
77
|
+
"key": 3,
|
|
78
|
+
"witness": {
|
|
79
|
+
"path": [
|
|
80
|
+
{
|
|
81
|
+
"cut": {
|
|
82
|
+
"at": 1
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"cut": {
|
|
87
|
+
"at": 2
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"cut": {
|
|
92
|
+
"at": 3
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"ends": [
|
|
98
|
+
{
|
|
99
|
+
"posts": [],
|
|
100
|
+
"cuts": [1, 2, 3]
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A ring of six places with a post on place 3, and the goal a post on every place from 5 round past the last to 2: the stretch goes on round the ring, so 5, 6, 1 and 2 need a post each, 4 moves, and the post on 3 counts for nothing.",
|
|
3
|
+
"scene": {
|
|
4
|
+
"line": {
|
|
5
|
+
"places": 6,
|
|
6
|
+
"first": 1,
|
|
7
|
+
"closed": true,
|
|
8
|
+
"posts": [3]
|
|
9
|
+
},
|
|
10
|
+
"operations": {
|
|
11
|
+
"post": {}
|
|
12
|
+
},
|
|
13
|
+
"goal": {
|
|
14
|
+
"every": {
|
|
15
|
+
"from": 5,
|
|
16
|
+
"to": 2
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"seed": "0",
|
|
21
|
+
"start": {
|
|
22
|
+
"state": {
|
|
23
|
+
"posts": [3]
|
|
24
|
+
},
|
|
25
|
+
"goal": false
|
|
26
|
+
},
|
|
27
|
+
"sequences": [
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
"move": {
|
|
31
|
+
"post": {
|
|
32
|
+
"at": 5
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"state": {
|
|
36
|
+
"posts": [3, 5]
|
|
37
|
+
},
|
|
38
|
+
"goal": false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"move": {
|
|
42
|
+
"post": {
|
|
43
|
+
"at": 6
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"state": {
|
|
47
|
+
"posts": [3, 5, 6]
|
|
48
|
+
},
|
|
49
|
+
"goal": false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"move": {
|
|
53
|
+
"post": {
|
|
54
|
+
"at": 1
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"state": {
|
|
58
|
+
"posts": [1, 3, 5, 6]
|
|
59
|
+
},
|
|
60
|
+
"goal": false
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"move": {
|
|
64
|
+
"post": {
|
|
65
|
+
"at": 2
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"state": {
|
|
69
|
+
"posts": [1, 2, 3, 5, 6]
|
|
70
|
+
},
|
|
71
|
+
"goal": true
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
],
|
|
75
|
+
"proof": {
|
|
76
|
+
"key": 4,
|
|
77
|
+
"witness": {
|
|
78
|
+
"path": [
|
|
79
|
+
{
|
|
80
|
+
"post": {
|
|
81
|
+
"at": 1
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"post": {
|
|
86
|
+
"at": 2
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"post": {
|
|
91
|
+
"at": 5
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"post": {
|
|
96
|
+
"at": 6
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"ends": [
|
|
102
|
+
{
|
|
103
|
+
"posts": [1, 2, 3, 5, 6]
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A jumper on a ring of twelve places from 0, starting on 0 and jumping five places forward or back, never off the ring: past the last place it goes on round from the first. The fewest jumps to place 1 are 5 forward, 0, 5, 10, 3, 8, 1, where back it takes 7, 0, 7, 2 and on; the jumper's distance is the shorter way round to its start.",
|
|
3
|
+
"scene": {
|
|
4
|
+
"line": {
|
|
5
|
+
"places": 12,
|
|
6
|
+
"closed": true
|
|
7
|
+
},
|
|
8
|
+
"operations": {
|
|
9
|
+
"jump": {
|
|
10
|
+
"from": 0,
|
|
11
|
+
"step": 5,
|
|
12
|
+
"back": true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"goal": {
|
|
16
|
+
"counters": {
|
|
17
|
+
"is": {
|
|
18
|
+
"at": 1
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"seed": "0",
|
|
24
|
+
"start": {
|
|
25
|
+
"state": {
|
|
26
|
+
"posts": [],
|
|
27
|
+
"at": 0
|
|
28
|
+
},
|
|
29
|
+
"goal": false
|
|
30
|
+
},
|
|
31
|
+
"sequences": [
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
"move": {
|
|
35
|
+
"jump": "forward"
|
|
36
|
+
},
|
|
37
|
+
"state": {
|
|
38
|
+
"posts": [],
|
|
39
|
+
"at": 5
|
|
40
|
+
},
|
|
41
|
+
"goal": false
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"move": {
|
|
45
|
+
"jump": "forward"
|
|
46
|
+
},
|
|
47
|
+
"state": {
|
|
48
|
+
"posts": [],
|
|
49
|
+
"at": 10
|
|
50
|
+
},
|
|
51
|
+
"goal": false
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"move": {
|
|
55
|
+
"jump": "forward"
|
|
56
|
+
},
|
|
57
|
+
"state": {
|
|
58
|
+
"posts": [],
|
|
59
|
+
"at": 3
|
|
60
|
+
},
|
|
61
|
+
"goal": false
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"move": {
|
|
65
|
+
"jump": "forward"
|
|
66
|
+
},
|
|
67
|
+
"state": {
|
|
68
|
+
"posts": [],
|
|
69
|
+
"at": 8
|
|
70
|
+
},
|
|
71
|
+
"goal": false
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"move": {
|
|
75
|
+
"jump": "forward"
|
|
76
|
+
},
|
|
77
|
+
"state": {
|
|
78
|
+
"posts": [],
|
|
79
|
+
"at": 1
|
|
80
|
+
},
|
|
81
|
+
"goal": true
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
{
|
|
86
|
+
"move": {
|
|
87
|
+
"jump": "back"
|
|
88
|
+
},
|
|
89
|
+
"state": {
|
|
90
|
+
"posts": [],
|
|
91
|
+
"at": 7
|
|
92
|
+
},
|
|
93
|
+
"goal": false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"move": {
|
|
97
|
+
"jump": "back"
|
|
98
|
+
},
|
|
99
|
+
"state": {
|
|
100
|
+
"posts": [],
|
|
101
|
+
"at": 2
|
|
102
|
+
},
|
|
103
|
+
"goal": false
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
],
|
|
107
|
+
"proof": {
|
|
108
|
+
"key": 5,
|
|
109
|
+
"witness": {
|
|
110
|
+
"path": [
|
|
111
|
+
{
|
|
112
|
+
"jump": "forward"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"jump": "forward"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"jump": "forward"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"jump": "forward"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"jump": "forward"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"ends": [
|
|
129
|
+
{
|
|
130
|
+
"posts": [],
|
|
131
|
+
"at": 1
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { SceneError } from "./kind.js";
|
|
2
|
+
declare const lowest: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* A fraction in lowest terms: its sign in the numerator, its denominator 1 or more. Only the core
|
|
5
|
+
* makes one, by fraction or parseFraction, so every operation may take both for granted.
|
|
6
|
+
*/
|
|
7
|
+
export interface Fraction {
|
|
8
|
+
readonly num: number;
|
|
9
|
+
readonly den: number;
|
|
10
|
+
readonly [lowest]: true;
|
|
11
|
+
}
|
|
12
|
+
/** A whole number with its remainder, the remainder from 0 to the divisor's size less one. */
|
|
13
|
+
export interface Division {
|
|
14
|
+
readonly quotient: number;
|
|
15
|
+
readonly remainder: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The pattern of a fraction as JSON writes it in a scene and a state: the one form module-kit's
|
|
19
|
+
* solver answers in, an integer or `p/q` in lowest terms with the sign before p, as "0", "-3" or
|
|
20
|
+
* "7/2". A module's key may write a fraction in any form of its value, but a scene and a state
|
|
21
|
+
* write it in this one alone, and "2/4" or "3/1" there is an error. The pattern cannot see lowest
|
|
22
|
+
* terms or the bounds of a safe integer; parseFraction does.
|
|
23
|
+
*/
|
|
24
|
+
export declare const fractionPattern = "^(0|-?[1-9][0-9]{0,15}(/([2-9]|[1-9][0-9]{1,15}))?)$";
|
|
25
|
+
/** The part of a kind's schema for a fraction in a scene or a state. */
|
|
26
|
+
export declare const fractionSchema: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly pattern: "^(0|-?[1-9][0-9]{0,15}(/([2-9]|[1-9][0-9]{1,15}))?)$";
|
|
29
|
+
readonly description: 'A number, exact: an integer or a fraction in lowest terms with its sign before the numerator, as "0", "-3" or "7/2".';
|
|
30
|
+
};
|
|
31
|
+
/** The fraction num/den in lowest terms; a denominator of 0 or a part not a safe integer throws. */
|
|
32
|
+
export declare function fraction(num: number, den?: number): Fraction;
|
|
33
|
+
/** a + b. */
|
|
34
|
+
export declare function add(a: Fraction, b: Fraction): Fraction;
|
|
35
|
+
/** a − b. */
|
|
36
|
+
export declare function subtract(a: Fraction, b: Fraction): Fraction;
|
|
37
|
+
/** a · b. */
|
|
38
|
+
export declare function multiply(a: Fraction, b: Fraction): Fraction;
|
|
39
|
+
/** a ÷ b; b of 0 throws. */
|
|
40
|
+
export declare function divide(a: Fraction, b: Fraction): Fraction;
|
|
41
|
+
/** −1, 0 or 1 as a is less than, equal to or greater than b. */
|
|
42
|
+
export declare function compare(a: Fraction, b: Fraction): -1 | 0 | 1;
|
|
43
|
+
/**
|
|
44
|
+
* The whole quotient of a by b and its remainder, from 0 to |b| − 1 whatever the signs: a place on
|
|
45
|
+
* a ring of b, counted on from any whole number. b of 0 throws.
|
|
46
|
+
*/
|
|
47
|
+
export declare function divideWithRemainder(a: number, b: number): Division;
|
|
48
|
+
/** The greatest common divisor of a and b, never negative; of 0 and 0, 0. */
|
|
49
|
+
export declare function gcd(a: number, b: number): number;
|
|
50
|
+
/** The least common multiple of a and b, never negative; 0 where either is 0. */
|
|
51
|
+
export declare function lcm(a: number, b: number): number;
|
|
52
|
+
/** A fraction in the notation of fractionPattern, for a scene or a state. */
|
|
53
|
+
export declare function fractionText(value: Fraction): string;
|
|
54
|
+
/**
|
|
55
|
+
* The fraction a text writes in the notation of fractionPattern, or undefined where it writes
|
|
56
|
+
* none: a fraction not in lowest terms, with the denominator 1, or a part past a safe integer, the
|
|
57
|
+
* pattern's matches among them. One value has one text, so a state that holds it keys as one.
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseFraction(value: string): Fraction | undefined;
|
|
60
|
+
/** A fraction of a scene by fractionSchema, read as the other readers of a scene's JSON are. */
|
|
61
|
+
export declare function readFraction(value: unknown, path: string, errors: SceneError[]): Fraction | undefined;
|
|
62
|
+
export {};
|