@openbooknetwork/hesap 0.2.3 → 0.3.1
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/package.json +2 -2
- package/src/client.css +254 -1
- package/src/families/counters/add-figures.js +85 -0
- package/src/families/counters/add-goals.js +82 -0
- package/src/families/counters/add-model.js +82 -0
- package/src/families/counters/add.js +442 -0
- package/src/families/counters/add.mjs +102 -0
- package/src/families/counters/bonds.js +5 -5
- package/src/families/counters/client.css +126 -1
- package/src/families/counters/client.js +10 -12
- package/src/families/counters/count-figures.js +23 -3
- package/src/families/counters/count-model.js +5 -0
- package/src/families/counters/count.js +31 -9
- package/src/families/counters/count.mjs +5 -3
- package/src/families/counters/counter.js +25 -0
- package/src/families/counters/goals.js +1 -9
- package/src/families/counters/i18n/en.yaml +142 -30
- package/src/families/counters/i18n/tr.yaml +116 -4
- package/src/families/counters/index.mjs +11 -6
- package/src/families/counters/match-figures.js +60 -0
- package/src/families/counters/match-goals.js +63 -0
- package/src/families/counters/match-model.js +93 -0
- package/src/families/counters/match.js +399 -0
- package/src/families/counters/match.mjs +102 -0
- package/src/families/counters/order-figures.js +46 -0
- package/src/families/counters/order-model.js +69 -0
- package/src/families/counters/order.js +199 -0
- package/src/families/counters/order.mjs +62 -0
- package/src/families/counters/reading.js +66 -0
- package/src/families/counters/scenes.js +18 -0
- package/src/families/line/client.css +118 -0
- package/src/families/line/client.js +12 -0
- package/src/families/line/figures.js +143 -0
- package/src/families/line/goals.js +168 -0
- package/src/families/line/i18n/en.yaml +61 -0
- package/src/families/line/i18n/tr.yaml +61 -0
- package/src/families/line/index.mjs +227 -0
- package/src/families/line/lens.js +49 -0
- package/src/families/line/line.js +624 -0
- package/src/families/line/model.js +219 -0
- package/src/families.mjs +2 -1
- package/src/i18n/en.yaml +211 -31
- package/src/i18n/tr.yaml +184 -4
- package/src/kit/i18n/en.yaml +8 -1
- package/src/kit/i18n/tr.yaml +7 -0
- package/src/kit/kit.css +9 -0
- package/src/kit/panel.js +9 -4
- package/src/kit/random.js +9 -0
- package/src/kit/written.js +70 -0
- package/src/node.mjs +13 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
counters_lead: "Tap
|
|
1
|
+
counters_lead: "Tap or drag the counters and watch the numbers change."
|
|
2
2
|
counters_whole: Whole
|
|
3
3
|
counters_first: First part
|
|
4
4
|
counters_second: Second part
|
|
5
5
|
counters_empty: Empty cells
|
|
6
|
-
counters_added:
|
|
6
|
+
counters_added: Added
|
|
7
7
|
counters_found: Splits found
|
|
8
8
|
counters_ways: Splits in all
|
|
9
9
|
counters_hands-first: Left hand
|
|
@@ -12,11 +12,11 @@ counters_hands-whole: Beads
|
|
|
12
12
|
counters_one-first: Counters
|
|
13
13
|
counters_one-found: Pairs found
|
|
14
14
|
counters_one-ways: Pairs in all
|
|
15
|
-
counters_two-first:
|
|
16
|
-
counters_two-second:
|
|
17
|
-
counters_cup-first:
|
|
18
|
-
counters_cup-second:
|
|
19
|
-
counters_cup-added:
|
|
15
|
+
counters_two-first: First part
|
|
16
|
+
counters_two-second: Second part
|
|
17
|
+
counters_cup-first: Known part
|
|
18
|
+
counters_cup-second: Missing part
|
|
19
|
+
counters_cup-added: Added
|
|
20
20
|
counters_pins-first: Standing
|
|
21
21
|
counters_pins-empty: Knocked down
|
|
22
22
|
counters_cars-first: Parked
|
|
@@ -27,8 +27,7 @@ counters_fill: Fill the second frame
|
|
|
27
27
|
counters_unfill: Empty the second frame
|
|
28
28
|
counters_lift: Lift the cup
|
|
29
29
|
counters_lower: Put the cup back
|
|
30
|
-
|
|
31
|
-
counters_blue: Blue counters
|
|
30
|
+
counters_blue: Second part
|
|
32
31
|
counters_tray: Tray
|
|
33
32
|
counters_pile: Pile
|
|
34
33
|
counters_cup: Cup
|
|
@@ -41,15 +40,15 @@ counters_free: Free
|
|
|
41
40
|
counters_pair: "{a} and {b}"
|
|
42
41
|
counters_list-splits: "Splits of {x}"
|
|
43
42
|
counters_list-pairs: "Pairs that make {x}"
|
|
44
|
-
counters_goal-make-whole: "
|
|
45
|
-
counters_goal-make-whole-two: "
|
|
46
|
-
counters_goal-hidden-part: "The whole is {whole}
|
|
47
|
-
counters_note-short:
|
|
48
|
-
counters_note-over:
|
|
49
|
-
counters_note-more:
|
|
50
|
-
counters_note-fewer:
|
|
51
|
-
counters_hint-make-whole: "Count on from {part} to {whole}
|
|
52
|
-
counters_hint-hidden-part: "Count on from {part} to {whole}
|
|
43
|
+
counters_goal-make-whole: "Set the second part so that it makes {whole} with the first part, {part}, then press Check."
|
|
44
|
+
counters_goal-make-whole-two: "Set the second part so that it makes {whole} with the first part, {part}, then press Check."
|
|
45
|
+
counters_goal-hidden-part: "The whole is {whole} and the known part is {part}. Put the missing part in the tray, then lift the cup."
|
|
46
|
+
counters_note-short: "There are still empty cells, so add more counters to the second part."
|
|
47
|
+
counters_note-over: "There are more counters than cells, so take some counters out of the second part."
|
|
48
|
+
counters_note-more: "There are more counters in the tray than under the cup, so put some back on the pile."
|
|
49
|
+
counters_note-fewer: "There are fewer counters in the tray than under the cup, so put more in the tray."
|
|
50
|
+
counters_hint-make-whole: "Count on from {part} to {whole} and keep track of how many numbers you say. That is how many counters the second part needs."
|
|
51
|
+
counters_hint-hidden-part: "Count on from {part} to {whole} and keep track of how many numbers you say. That is how many counters are under the cup, so put that many in the tray."
|
|
53
52
|
counters_total: How many
|
|
54
53
|
counters_tag-count: Last number said
|
|
55
54
|
counters_take-count: Left
|
|
@@ -70,17 +69,130 @@ counters_kind-person: Person
|
|
|
70
69
|
counters_gap: Empty place
|
|
71
70
|
counters_basket: Basket
|
|
72
71
|
counters_stop-sign: Bus
|
|
73
|
-
counters_goal-fill-basket: "Put
|
|
74
|
-
counters_goal-count-on: "The box holds {box}. Put counters
|
|
75
|
-
counters_goal-count-back: "Take counters away until {target}
|
|
76
|
-
counters_note-fill-basket-more:
|
|
77
|
-
counters_note-fill-basket-fewer:
|
|
78
|
-
counters_note-count-on-more: The box and the counters
|
|
79
|
-
counters_note-count-on-fewer: The box and the counters
|
|
80
|
-
counters_note-count-back-more:
|
|
81
|
-
counters_note-count-back-fewer:
|
|
82
|
-
counters_hint-fill-basket: "
|
|
83
|
-
counters_hint-count-on: "Start
|
|
84
|
-
counters_hint-count-back: "Start
|
|
72
|
+
counters_goal-fill-basket: "Put apples in the basket until it holds {target}, then press Check."
|
|
73
|
+
counters_goal-count-on: "The box holds {box}. Put counters in the dashed space until there are {target} altogether, then press Check."
|
|
74
|
+
counters_goal-count-back: "Take counters away until the number left is {target}, then press Check."
|
|
75
|
+
counters_note-fill-basket-more: "There are more than {target} apples in the basket, so take some out."
|
|
76
|
+
counters_note-fill-basket-fewer: "There are fewer than {target} apples in the basket, so put more in."
|
|
77
|
+
counters_note-count-on-more: "The box and the counters you put out come to more than {target}, so take some counters away."
|
|
78
|
+
counters_note-count-on-fewer: "The box and the counters you put out come to fewer than {target}, so put out more counters."
|
|
79
|
+
counters_note-count-back-more: "The number left is greater than {target}, so take more counters away."
|
|
80
|
+
counters_note-count-back-fewer: "The number left is less than {target}, so put some counters back."
|
|
81
|
+
counters_hint-fill-basket: "Count each apple as you put it in, and stop when you get to {target}."
|
|
82
|
+
counters_hint-count-on: "Start at {box}. Say the next number each time you put out a counter, and stop when you get to {target}."
|
|
83
|
+
counters_hint-count-back: "Start at {start}. Count back one number each time you take a counter away, and stop when you get to {target}."
|
|
85
84
|
counters_roll: Roll the ball
|
|
86
85
|
counters_set-up: Set up the pins
|
|
86
|
+
counters_ctl-top: Top row
|
|
87
|
+
counters_ctl-bottom: Bottom row
|
|
88
|
+
counters_ctl-spread: Spacing
|
|
89
|
+
counters_match-unpaired: Without a partner
|
|
90
|
+
counters_match-pairs: Pairs
|
|
91
|
+
counters_word-same: The same
|
|
92
|
+
counters_tag-more: more
|
|
93
|
+
counters_tag-fewer: fewer
|
|
94
|
+
counters_tag-same: the same
|
|
95
|
+
counters_tag-more-n: "{n} more"
|
|
96
|
+
counters_tag-fewer-n: "{n} fewer"
|
|
97
|
+
counters_match-top: Top row
|
|
98
|
+
counters_match-bottom: Bottom row
|
|
99
|
+
counters_match-counted: Last number said
|
|
100
|
+
counters_match-added: Added
|
|
101
|
+
counters_match-taken: Taken away
|
|
102
|
+
counters_match-chairs-top: Players
|
|
103
|
+
counters_match-chairs-bottom: Chairs
|
|
104
|
+
counters_chairs-stop: Stop the music
|
|
105
|
+
counters_chairs-next: Next round
|
|
106
|
+
counters_chairs-again: Play again
|
|
107
|
+
counters_row-now: now
|
|
108
|
+
counters_row-before: before
|
|
109
|
+
counters_match-trail-top: Now
|
|
110
|
+
counters_match-trail-bottom: Before
|
|
111
|
+
counters_one-less: one less
|
|
112
|
+
counters_one-more: one more
|
|
113
|
+
counters_sides-count: Number
|
|
114
|
+
counters_sides-before: Number before
|
|
115
|
+
counters_sides-after: Number after
|
|
116
|
+
counters_reading-less: "{a} is less than {b}"
|
|
117
|
+
counters_reading-same: "{a} is the same as {b}"
|
|
118
|
+
counters_reading-greater: "{a} is greater than {b}"
|
|
119
|
+
counters_is-less: is less than
|
|
120
|
+
counters_is-greater: is greater than
|
|
121
|
+
counters_least: least
|
|
122
|
+
counters_greatest: greatest
|
|
123
|
+
counters_show-rows: Show the rows
|
|
124
|
+
counters_order-top: First number
|
|
125
|
+
counters_order-bottom: Second number
|
|
126
|
+
counters_order-top-rows: "Full rows of the first"
|
|
127
|
+
counters_order-top-last: "Last row of the first"
|
|
128
|
+
counters_order-bottom-rows: "Full rows of the second"
|
|
129
|
+
counters_order-bottom-last: "Last row of the second"
|
|
130
|
+
counters_reading-equal: "{a} is equal to {b}"
|
|
131
|
+
counters_verdict-true: "true"
|
|
132
|
+
counters_verdict-false: "false"
|
|
133
|
+
counters_sign: Sign
|
|
134
|
+
counters_match-reading: In words
|
|
135
|
+
counters_match-verdict: True or false
|
|
136
|
+
counters_match-scoreboard-top: Home
|
|
137
|
+
counters_match-scoreboard-bottom: Away
|
|
138
|
+
counters_score-top: Home goal
|
|
139
|
+
counters_score-bottom: Away goal
|
|
140
|
+
counters_new-match: New match
|
|
141
|
+
counters_goal-same-rows: "Give the top row as many counters as the bottom row, then press Check."
|
|
142
|
+
counters_note-same-rows-top: "Some counters in the top row have no partner, so take some away from the top row."
|
|
143
|
+
counters_note-same-rows-bottom: "Some counters in the bottom row have no partner, so add counters to the top row."
|
|
144
|
+
counters_hint-same-rows: "Pair up the counters in the two rows. Then add counters to the top row or take some away until every counter has a partner."
|
|
145
|
+
counters_goal-one-less: "Give the top row one fewer counter than the bottom row, then press Check."
|
|
146
|
+
counters_note-one-less-over: "The top row has too many counters, so take some away."
|
|
147
|
+
counters_note-one-less-short: "The top row has too few counters, so add some."
|
|
148
|
+
counters_hint-one-less: "Pair up the counters in the two rows. Then change the top row until just one counter in the bottom row has no partner."
|
|
149
|
+
counters_goal-right-sign: "Put the sign that makes the number sentence true between the two rows, then press Check."
|
|
150
|
+
counters_note-right-sign-more: The top row has more counters than this sign says.
|
|
151
|
+
counters_note-right-sign-fewer: The top row has fewer counters than this sign says.
|
|
152
|
+
counters_hint-right-sign: "Pair up the counters in the two rows. The row with counters left over has more, and the open side of the sign faces that row. If no counters are left over, the sign is =."
|
|
153
|
+
counters_new-numbers: New numbers
|
|
154
|
+
counters_add-first: First number
|
|
155
|
+
counters_add-second: Second number
|
|
156
|
+
counters_add-waiting: Still to join
|
|
157
|
+
counters_add-sum: Sum
|
|
158
|
+
counters_add-dice-sum: Counters in the frames
|
|
159
|
+
counters_add-roll: Roll
|
|
160
|
+
counters_add-die: "Die showing {x}"
|
|
161
|
+
counters_add-counter-waiting: "Counter waiting to join"
|
|
162
|
+
counters_add-counter-joined: "Counter that has joined"
|
|
163
|
+
counters_add-take-second: Taken away
|
|
164
|
+
counters_add-left: Left
|
|
165
|
+
counters_add-take-counter: Counter
|
|
166
|
+
counters_add-take-ring: "Empty ring where a counter was taken away"
|
|
167
|
+
counters_add-shelf-first: Morning
|
|
168
|
+
counters_add-shelf-second: Afternoon
|
|
169
|
+
counters_add-shelf-sum: Sold
|
|
170
|
+
counters_add-shelf-written: Jars sold
|
|
171
|
+
counters_add-shelf-written-left: Jars left
|
|
172
|
+
counters_add-shelf-reading: Jars sold in words
|
|
173
|
+
counters_add-shelf-reading-left: Jars left in words
|
|
174
|
+
counters_add-shelf-crate: Sold in the
|
|
175
|
+
counters_add-shelf-jar: Jar on the shelf
|
|
176
|
+
counters_add-sold-jar: "Jar {x} in the crate"
|
|
177
|
+
counters_add-to-ten: Makes ten
|
|
178
|
+
counters_add-rest: The rest
|
|
179
|
+
counters_add-seedling: Seedling
|
|
180
|
+
counters_add-sprout: Sprout
|
|
181
|
+
counters_add-seed-waiting: Seed in the packet
|
|
182
|
+
counters_add-seed-joined: Sprout in the tray
|
|
183
|
+
counters_goal-find-sum: "Set the sum of {a} and {b} on the Sum stepper, then press Check."
|
|
184
|
+
counters_goal-find-sum-done: "A group of {a} and a group of {b} make {sum} altogether."
|
|
185
|
+
counters_note-find-sum-less: "The sum is less than {n}."
|
|
186
|
+
counters_note-find-sum-greater: "The sum is greater than {n}."
|
|
187
|
+
counters_hint-find-sum: "Picture {a} counters in the frames and {b} more counters joining them. Start at {a} and count on one number for each counter that joins."
|
|
188
|
+
counters_goal-steps-to-ten: "Split the {second} in {calc} into the part that makes ten with {first} and the rest, then press Check."
|
|
189
|
+
counters_goal-steps-to-ten-done: "{line}. The two steps are {toTen} and {rest}."
|
|
190
|
+
counters_note-steps-to-ten-past: "{step} goes past 10."
|
|
191
|
+
counters_note-steps-to-ten-short: "{step} does not reach 10."
|
|
192
|
+
counters_note-steps-to-ten-more: "{x} and {y} make more than {second}, so make the rest smaller."
|
|
193
|
+
counters_note-steps-to-ten-less: "{x} and {y} make less than {second}, so make the rest greater."
|
|
194
|
+
counters_hint-steps-to-ten-plus: "First work out how many {first} needs to make 10, and set that. Then set what is left of the {second}."
|
|
195
|
+
counters_hint-steps-to-ten-minus: "First work out how many to take away to bring {first} down to 10, and set that. Then set what is left of the {second}."
|
|
196
|
+
counters_add-take-to-ten: Down to ten
|
|
197
|
+
counters_goal-steps-to-ten-minus: "Split the {second} in {calc} into the part that takes {first} down to ten and the rest, then press Check."
|
|
198
|
+
counters_add-shelf-left: Left
|
|
@@ -14,8 +14,8 @@ counters_one-found: Bulunan ikililer
|
|
|
14
14
|
counters_one-ways: Tüm ikililer
|
|
15
15
|
counters_two-first: Kırmızı
|
|
16
16
|
counters_two-second: Mavi
|
|
17
|
-
counters_cup-first:
|
|
18
|
-
counters_cup-second:
|
|
17
|
+
counters_cup-first: Bilinen parça
|
|
18
|
+
counters_cup-second: Bilinmeyen parça
|
|
19
19
|
counters_cup-added: Eklenen mavi
|
|
20
20
|
counters_pins-first: Ayakta
|
|
21
21
|
counters_pins-empty: Devrilen
|
|
@@ -27,7 +27,6 @@ counters_fill: İkinci çerçeveyi doldur
|
|
|
27
27
|
counters_unfill: İkinci çerçeveyi boşalt
|
|
28
28
|
counters_lift: Bardağı kaldır
|
|
29
29
|
counters_lower: Bardağı geri koy
|
|
30
|
-
counters_check: Kontrol et
|
|
31
30
|
counters_blue: Mavi sayaçlar
|
|
32
31
|
counters_tray: Tepsi
|
|
33
32
|
counters_pile: Yığın
|
|
@@ -43,7 +42,7 @@ counters_list-splits: "{x} sayısının ayrımları"
|
|
|
43
42
|
counters_list-pairs: "{x} yapan ikililer"
|
|
44
43
|
counters_goal-make-whole: "Kırmızı tepside {part} sayaç var. Çerçeve {whole} sayaç tutacak biçimde mavi sayaçları ayarlayın, sonra Kontrol et düğmesine basın."
|
|
45
44
|
counters_goal-make-whole-two: "Kırmızı tepside {part} sayaç var. İki çerçeve {whole} sayaç tutacak biçimde mavi sayaçları ayarlayın, sonra Kontrol et düğmesine basın."
|
|
46
|
-
counters_goal-hidden-part: "Bütün {whole},
|
|
45
|
+
counters_goal-hidden-part: "Bütün {whole}, bilinen parça {part}. Bardağın altındaki parçayı tepside kurun, sonra bardağı kaldırın."
|
|
47
46
|
counters_note-short: Bazı hücreler hâlâ boş.
|
|
48
47
|
counters_note-over: Bazı sayaçlara hücre kalmadı.
|
|
49
48
|
counters_note-more: Tepside bardaktakinden çok sayaç var.
|
|
@@ -84,3 +83,116 @@ counters_hint-count-on: "{box} sayısından başlayın ve kutunun yanına koydu
|
|
|
84
83
|
counters_hint-count-back: "{start} sayısından başlayın ve aldığınız her sayaç için bir önceki sayıyı söyleyin. {target} sayısında durun."
|
|
85
84
|
counters_roll: Topu yuvarla
|
|
86
85
|
counters_set-up: Lobutları diz
|
|
86
|
+
counters_ctl-top: Üst sıra
|
|
87
|
+
counters_ctl-bottom: Alt sıra
|
|
88
|
+
counters_ctl-spread: Aralık
|
|
89
|
+
counters_match-unpaired: Eşleşmeyen
|
|
90
|
+
counters_match-pairs: Eşleşenler
|
|
91
|
+
counters_word-same: Aynı
|
|
92
|
+
counters_tag-more: daha çok
|
|
93
|
+
counters_tag-fewer: daha az
|
|
94
|
+
counters_tag-same: aynı
|
|
95
|
+
counters_tag-more-n: "{n} daha çok"
|
|
96
|
+
counters_tag-fewer-n: "{n} daha az"
|
|
97
|
+
counters_match-top: Üst sıra
|
|
98
|
+
counters_match-bottom: Alt sıra
|
|
99
|
+
counters_match-counted: Son söylenen sayı
|
|
100
|
+
counters_match-added: Eklenen
|
|
101
|
+
counters_match-taken: Çıkarılan
|
|
102
|
+
counters_match-chairs-top: Oyuncular
|
|
103
|
+
counters_match-chairs-bottom: Sandalyeler
|
|
104
|
+
counters_chairs-stop: Müziği durdur
|
|
105
|
+
counters_chairs-next: Sonraki tur
|
|
106
|
+
counters_chairs-again: Yeniden oyna
|
|
107
|
+
counters_row-now: şimdi
|
|
108
|
+
counters_row-before: önce
|
|
109
|
+
counters_match-trail-top: Şimdi
|
|
110
|
+
counters_match-trail-bottom: Önce
|
|
111
|
+
counters_one-less: bir eksik
|
|
112
|
+
counters_one-more: bir fazla
|
|
113
|
+
counters_sides-count: Sayı
|
|
114
|
+
counters_sides-before: Önceki sayı
|
|
115
|
+
counters_sides-after: Sonraki sayı
|
|
116
|
+
counters_reading-less: "{a}, {b} sayısından küçüktür"
|
|
117
|
+
counters_reading-same: "{a}, {b} ile aynıdır"
|
|
118
|
+
counters_reading-greater: "{a}, {b} sayısından büyüktür"
|
|
119
|
+
counters_is-less: küçüktür
|
|
120
|
+
counters_is-greater: büyüktür
|
|
121
|
+
counters_least: en küçük
|
|
122
|
+
counters_greatest: en büyük
|
|
123
|
+
counters_show-rows: Sıraları göster
|
|
124
|
+
counters_order-top: Birinci sayı
|
|
125
|
+
counters_order-bottom: İkinci sayı
|
|
126
|
+
counters_order-top-rows: "Birinci, tam sıralar"
|
|
127
|
+
counters_order-top-last: "Birinci, son sıra"
|
|
128
|
+
counters_order-bottom-rows: "İkinci, tam sıralar"
|
|
129
|
+
counters_order-bottom-last: "İkinci, son sıra"
|
|
130
|
+
counters_reading-equal: "{a}, {b} sayısına eşittir"
|
|
131
|
+
counters_verdict-true: "doğru"
|
|
132
|
+
counters_verdict-false: "yanlış"
|
|
133
|
+
counters_sign: İşaret
|
|
134
|
+
counters_match-reading: Sözle
|
|
135
|
+
counters_match-verdict: İfade
|
|
136
|
+
counters_match-scoreboard-top: Ev sahibi
|
|
137
|
+
counters_match-scoreboard-bottom: Deplasman
|
|
138
|
+
counters_score-top: Ev sahibi golü
|
|
139
|
+
counters_score-bottom: Deplasman golü
|
|
140
|
+
counters_new-match: Yeni maç
|
|
141
|
+
counters_goal-same-rows: "Üst sırayı alt sırayla aynı yapın, sonra Kontrol et düğmesine basın."
|
|
142
|
+
counters_note-same-rows-top: Üst sıradaki bazı sayaçlar eşleşmedi.
|
|
143
|
+
counters_note-same-rows-bottom: Alt sıradaki bazı sayaçlar eşleşmedi.
|
|
144
|
+
counters_hint-same-rows: "Her üst sayaçtan bir alt sayaca çizgi çizin. Çizgisiz kalan sayaçlar neyi değiştireceğinizi gösterir."
|
|
145
|
+
counters_goal-one-less: "Üst sıraya alt sıradan bir sayaç az verin, sonra Kontrol et düğmesine basın."
|
|
146
|
+
counters_note-one-less-over: Üst sırada fazla sayaç var.
|
|
147
|
+
counters_note-one-less-short: Üst sırada eksik sayaç var.
|
|
148
|
+
counters_hint-one-less: "Sıraları eşleştirin. Bir sayaç az olunca alt sıranın bir sayacı eşleşmeden kalır."
|
|
149
|
+
counters_goal-right-sign: "İki sıranın arasına ifadeyi doğru yapan işareti koyun, sonra Kontrol et düğmesine basın."
|
|
150
|
+
counters_note-right-sign-more: Üst sırada bu işaretin söylediğinden çok sayaç var.
|
|
151
|
+
counters_note-right-sign-fewer: Üst sırada bu işaretin söylediğinden az sayaç var.
|
|
152
|
+
counters_hint-right-sign: "Her üst sayaçtan bir alt sayaca çizgi çizin. Eşleşmeyen sayacı kalan sırada daha çok sayaç vardır ve işaretin açık yanı ona bakar. Hiç sayaç kalmazsa işaret = olur."
|
|
153
|
+
counters_new-numbers: Yeni sayılar
|
|
154
|
+
counters_add-first: Birinci sayı
|
|
155
|
+
counters_add-second: İkinci sayı
|
|
156
|
+
counters_add-waiting: Bekleyen
|
|
157
|
+
counters_add-sum: Toplam
|
|
158
|
+
counters_add-dice-sum: Çerçevelerdeki sayaçlar
|
|
159
|
+
counters_add-roll: Zar at
|
|
160
|
+
counters_add-die: "{x} gösteren zar"
|
|
161
|
+
counters_add-counter-waiting: Bekleyen sayaç
|
|
162
|
+
counters_add-counter-joined: Bir araya getirilen sayaç
|
|
163
|
+
counters_add-take-second: Çıkan
|
|
164
|
+
counters_add-left: Fark
|
|
165
|
+
counters_add-take-counter: Sayaç
|
|
166
|
+
counters_add-take-ring: Çıkan sayacın halkası
|
|
167
|
+
counters_add-shelf-first: Sabah
|
|
168
|
+
counters_add-shelf-second: Öğleden sonra
|
|
169
|
+
counters_add-shelf-sum: Satılan
|
|
170
|
+
counters_add-shelf-written: Satılan kavanozlar
|
|
171
|
+
counters_add-shelf-written-left: Kalan kavanozlar
|
|
172
|
+
counters_add-shelf-reading: Satılan kavanozlar sözle
|
|
173
|
+
counters_add-shelf-reading-left: Kalan kavanozlar sözle
|
|
174
|
+
counters_add-shelf-crate: Satış kasası
|
|
175
|
+
counters_add-shelf-jar: Raftaki kavanoz
|
|
176
|
+
counters_add-sold-jar: "Kasadaki kavanoz, {x}"
|
|
177
|
+
counters_add-to-ten: 10'a tamamlayan
|
|
178
|
+
counters_add-rest: Diğer parça
|
|
179
|
+
counters_add-seedling: Fide
|
|
180
|
+
counters_add-sprout: Filiz
|
|
181
|
+
counters_add-seed-waiting: Paketteki tohum
|
|
182
|
+
counters_add-seed-joined: Viyoldeki filiz
|
|
183
|
+
counters_goal-find-sum: "{a} ile {b} sayısının toplamını Toplam düğmeleriyle ayarlayın, sonra Kontrol et düğmesine basın."
|
|
184
|
+
counters_goal-find-sum-done: "{a} sayaçlık bir grup ile {b} sayaçlık bir grup bir araya gelince {sum} eder."
|
|
185
|
+
counters_note-find-sum-less: "Toplam {n} sayısından küçük."
|
|
186
|
+
counters_note-find-sum-greater: "Toplam {n} sayısından büyük."
|
|
187
|
+
counters_hint-find-sum: "Çerçevelerde {a} kırmızı sayaç ve onlarla bir araya gelen {b} mavi sayaç düşünün. {a} sayısından başlayıp her mavi sayaç için bir sayı ileri sayın."
|
|
188
|
+
counters_goal-steps-to-ten: "{calc} için 10'a tamamlayan ve Diğer parça düğmelerini ayarlayın, sonra Kontrol et düğmesine basın."
|
|
189
|
+
counters_goal-steps-to-ten-done: "{line}; {toTen} ve {rest}."
|
|
190
|
+
counters_note-steps-to-ten-past: "{step}, 10'u geçiyor."
|
|
191
|
+
counters_note-steps-to-ten-short: "{step}, 10'a varmıyor."
|
|
192
|
+
counters_note-steps-to-ten-more: "10'a tamamlayan ve Diğer parça, {second} sayısından çok ediyor."
|
|
193
|
+
counters_note-steps-to-ten-less: "10'a tamamlayan ve Diğer parça, {second} sayısından az ediyor."
|
|
194
|
+
counters_hint-steps-to-ten-plus: "10'a tamamlayan, {first} ile 10 eden sayıdır. Diğer parça, {second} sayısından geriye kalandır."
|
|
195
|
+
counters_hint-steps-to-ten-minus: "Ona kadar, {first} sayısının dolu onluğundan sonraki sayaçların sayısıdır. Diğer parça, {second} sayısından geriye kalandır."
|
|
196
|
+
counters_add-take-to-ten: Ona kadar
|
|
197
|
+
counters_goal-steps-to-ten-minus: "{calc} için Ona kadar ve Diğer parça düğmelerini ayarlayın, sonra Kontrol et düğmesine basın."
|
|
198
|
+
counters_add-shelf-left: Kalan
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
// The Node half of the counters family. The bonds scene moves counters between parts and fills ten frames,
|
|
2
|
-
// count scene counts objects one by one
|
|
3
|
-
//
|
|
1
|
+
// The Node half of the counters family. The bonds scene moves counters between parts and fills ten frames, the
|
|
2
|
+
// count scene counts objects one by one, the match scene pairs two rows, the order scene compares numbers, and the
|
|
3
|
+
// add scene joins two groups and writes their sum. It checks a page's fields against its scene and says what each
|
|
4
|
+
// link shows when the page opens.
|
|
4
5
|
import { schema } from '@openbooknetwork/kitap';
|
|
5
6
|
import { LOOKS, modeOf, capOf, opening, counts, measuresOf } from './model.js';
|
|
6
7
|
import { GOALS, challengeStart } from './goals.js';
|
|
7
8
|
import count from './count.mjs';
|
|
9
|
+
import match from './match.mjs';
|
|
10
|
+
import order from './order.mjs';
|
|
11
|
+
import add from './add.mjs';
|
|
8
12
|
import { numbers } from '../../kit/format.js';
|
|
9
13
|
import { list, challenge, drawn, value } from '../../node.mjs';
|
|
10
14
|
|
|
@@ -94,11 +98,12 @@ function startBonds(spec, lang, id) {
|
|
|
94
98
|
|
|
95
99
|
// Each scene checks its own fields, so the family's schema lets every field through to the scene.
|
|
96
100
|
const Fields = z.object({}).passthrough();
|
|
97
|
-
const
|
|
98
|
-
const
|
|
101
|
+
const SCENES = { bonds: { read: readBonds, start: startBonds }, count, match, order, add };
|
|
102
|
+
const read = ({ scene, ...fields }, info, ctx) => SCENES[scene].read(fields, info, ctx);
|
|
103
|
+
const start = (spec, lang, id) => SCENES[spec.scene].start(spec, lang, id);
|
|
99
104
|
|
|
100
105
|
// The two colours of the counters, a red and a blue that readers with any colour vision tell apart, each with a step
|
|
101
106
|
// for the dark themes.
|
|
102
107
|
const bundle = () => ({ families: { 'counters-red': { color: '#d1453b', color_dark: '#f0776d' }, 'counters-blue': { color: '#2a6bd1', color_dark: '#6fa4f5' } } });
|
|
103
108
|
|
|
104
|
-
export default { id: 'counters', scenes:
|
|
109
|
+
export default { id: 'counters', scenes: Object.keys(SCENES), schema: Fields, read, start, bundle };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// The places of a match figure: two rows of counters, or a tray of cups above a table of saucers. Each gives its
|
|
2
|
+
// size, the place of every object of the top and the bottom row, the height of the middle between the rows, and a
|
|
3
|
+
// draw for the parts that stay put.
|
|
4
|
+
import { svg as el } from '../../kit/dom.js';
|
|
5
|
+
import { R } from './counter.js';
|
|
6
|
+
import { txt } from './figures.js';
|
|
7
|
+
|
|
8
|
+
export const GAP = 40; // Counters of a row stand this far apart.
|
|
9
|
+
export const CLOSE = 33, WIDE = 40; // The gaps of the close and the wide row of a challenge.
|
|
10
|
+
const EDGE = 24; // The room round the rows, which holds a counter's touch target.
|
|
11
|
+
const DROP = 116; // The bottom row stands this far under the top row.
|
|
12
|
+
|
|
13
|
+
// rowsOf sets two rows out from the left. top and bottom are the most counters each row reaches. gap gives the gap
|
|
14
|
+
// of each row as it stands, and widest the greatest gap each row takes, which the figure keeps room for. tag is the
|
|
15
|
+
// room after the rows for the tag at a row's end, and names the room above and below them for a row's name. line
|
|
16
|
+
// is the width and the height of the line of two numbers under the rows, and the figure gives its place.
|
|
17
|
+
export function rowsOf({ top, bottom, gap = {}, widest = gap, tag = 0, names = 0, line = { w: 0, h: 0 } }) {
|
|
18
|
+
const room = { top, bottom };
|
|
19
|
+
const span = Math.max(...Object.keys(room).map(row => (Math.max(1, room[row]) - 1) * (widest[row] ?? GAP)));
|
|
20
|
+
const place = (row, y) => i => ({ x: EDGE + i * (gap[row] ?? GAP), y: y + names });
|
|
21
|
+
const h = DROP + 2 * EDGE + 2 * names;
|
|
22
|
+
return { w: Math.max(span + 2 * EDGE + tag, line.w + EDGE), h: h + line.h, mid: names + EDGE + DROP / 2, line: { x: EDGE - 16, y: h + line.h / 2 - 4 },
|
|
23
|
+
top: place('top', EDGE), bottom: place('bottom', EDGE + DROP), draw: () => ({ nodes: [] }) };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const CUP = 42, SAUCER = 58; // The cups of the tray and the saucers of the table stand this far apart.
|
|
27
|
+
const TRAY = 56, TABLE = 62; // The heights of the tray and the table.
|
|
28
|
+
const BETWEEN = 64; // The room between the tray and the table.
|
|
29
|
+
|
|
30
|
+
// cupsOf sets a tray of cups above a table of saucers. seat is the place of a cup that sits on a saucer.
|
|
31
|
+
export function cupsOf(top, bottom) {
|
|
32
|
+
const tw = Math.max(1, top) * CUP + 16, bw = Math.max(1, bottom) * SAUCER + 16, w = Math.max(tw, bw), ty = TRAY + BETWEEN;
|
|
33
|
+
const saucer = j => ({ x: (w - bw) / 2 + 8 + (j + 0.5) * SAUCER, y: ty + TABLE / 2 + 2 });
|
|
34
|
+
return {
|
|
35
|
+
w, h: ty + TABLE, mid: TRAY + BETWEEN / 2,
|
|
36
|
+
top: i => ({ x: (w - tw) / 2 + 8 + (i + 0.5) * CUP, y: TRAY / 2 }),
|
|
37
|
+
bottom: saucer,
|
|
38
|
+
seat: j => { const p = saucer(j); return { x: p.x, y: p.y - R * 0.85 }; },
|
|
39
|
+
draw: () => ({ nodes: [el('rect', { class: 'counters-tray', x: (w - tw) / 2, y: 0, width: tw, height: TRAY, rx: 12 }),
|
|
40
|
+
el('rect', { class: 'counters-table', x: (w - bw) / 2, y: ty, width: bw, height: TABLE, rx: 8 })] }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const BALL = 11; // The radius of a ball of the scoreboard.
|
|
45
|
+
// scoreOf sets a scoreboard out: the name and the score of two teams with a sign between the scores, and under
|
|
46
|
+
// each score room for max balls in rows of five. draw gives the board and the texts the scene writes: the two
|
|
47
|
+
// scores and the sign.
|
|
48
|
+
export function scoreOf(max, names) {
|
|
49
|
+
const w = 320, board = 132, half = w / 2, gap = 2 * BALL + 5, per = 5, rows = Math.ceil(max / per);
|
|
50
|
+
const ball = k => i => ({ x: (k + 0.5) * half + (i % per - (per - 1) / 2) * gap, y: board + 22 + Math.floor(i / per) * gap });
|
|
51
|
+
return {
|
|
52
|
+
w, h: board + 22 + (rows - 1) * gap + BALL + 6, mid: board / 2, top: ball(0), bottom: ball(1),
|
|
53
|
+
draw() {
|
|
54
|
+
const side = ['top', 'bottom'].map((r, k) => ({ name: txt(`counters-team counters-${k ? 'b' : 'a'}`, (k + 0.5) * half + (k ? 14 : -14), 28, names[k]), score: txt('counters-score', (k + 0.5) * half + (k ? 14 : -14), 84) }));
|
|
55
|
+
for (const [k, r] of ['top', 'bottom'].entries()) side[k].score.setAttribute('data-ref', r);
|
|
56
|
+
const sign = txt('counters-score-sign', half, 84);
|
|
57
|
+
return { nodes: [el('rect', { class: 'counters-board', x: 0, y: 0, width: w, height: board, rx: 14 }), ...side.flatMap(t => [t.name, t.score]), sign], refs: { top: side[0].score, bottom: side[1].score, sign } };
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// The goals a match page can name. The page declares ranges, and the goal draws two rows from them each time the
|
|
2
|
+
// page opens and each time the reader asks for another one. One of the rows stands wide and the other close, so the
|
|
3
|
+
// ends of the rows say nothing about their numbers. The build and the browser both use this file.
|
|
4
|
+
import { SIGNS, signOf } from './reading.js';
|
|
5
|
+
|
|
6
|
+
export const STEP = [0, 12]; // The stepper of the top row on a challenge page.
|
|
7
|
+
const TOPS = [1, 10], BOTTOMS = [3, 10], ROWS = [1, 10]; // The widest ranges a page may draw its rows from.
|
|
8
|
+
const span = ([lo, hi]) => Array.from({ length: Math.max(0, hi - lo + 1) }, (_, i) => lo + i);
|
|
9
|
+
const range = (r, [lo, hi]) => Array.isArray(r) && r.length === 2 && r.every(Number.isInteger) && r[0] <= r[1] && r[0] >= lo && r[1] <= hi;
|
|
10
|
+
const words = r => JSON.stringify(r ?? null);
|
|
11
|
+
// The two rows of a goal whose top row the reader steps: every pair of the page's ranges that fits.
|
|
12
|
+
const pairs = (c, fits) => span(c.bottom).flatMap(bottom => span(c.top).filter(top => fits(top, bottom)).map(top => ({ top, bottom })));
|
|
13
|
+
const ranges = c => !range(c.top, TOPS) ? `top is ${words(c.top)}, write the top row's range as [low, high] from ${TOPS[0]} to ${TOPS[1]}, such as [1, 10]`
|
|
14
|
+
: !range(c.bottom, BOTTOMS) ? `bottom is ${words(c.bottom)}, write the bottom row's range as [low, high] from ${BOTTOMS[0]} to ${BOTTOMS[1]}, such as [3, 10]` : null;
|
|
15
|
+
const extra = (c, names) => { const f = Object.keys(c).find(k => k !== 'goal' && !names.includes(k)); return f ? `${f} belongs to another goal, this one draws from ${names.join(' and ')}` : null; };
|
|
16
|
+
// A goal the reader reaches with the top row's stepper opens with that stepper and no lines.
|
|
17
|
+
const stepped = (fits, off) => ({
|
|
18
|
+
scenes: ['match'],
|
|
19
|
+
problem(c) {
|
|
20
|
+
const stop = extra(c, ['top', 'bottom']) ?? ranges(c);
|
|
21
|
+
return stop ?? (pairs(c, fits).length ? null : 'top and bottom leave no two rows to draw, widen one of them');
|
|
22
|
+
},
|
|
23
|
+
draw(c, spec, dice) { const all = pairs(c, fits); return all.length ? { ...dice.pick(all), wide: dice.pick(['top', 'bottom']) } : null; },
|
|
24
|
+
page: t => ({ top: t.top, bottom: t.bottom, wide: t.wide, topCtl: { kind: 'stepper', lo: STEP[0], hi: STEP[1] } }),
|
|
25
|
+
holds: (state, spec, c, t) => !state.checked ? { done: false } : off(state.top, state.bottom),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const MATCH_GOALS = {
|
|
29
|
+
// The reader steps the top row until it has as many counters as the bottom row. A wrong check names the row that
|
|
30
|
+
// has counters without a partner.
|
|
31
|
+
'same-rows': stepped((top, bottom) => top !== bottom, (top, bottom) => top === bottom ? { done: true } : { done: false, note: top > bottom ? 'top' : 'bottom' }),
|
|
32
|
+
// The reader steps the top row until it has one counter fewer than the bottom row. Once it has, each row shows
|
|
33
|
+
// its number at its end.
|
|
34
|
+
'one-less': { ...stepped((top, bottom) => top !== bottom - 1, (top, bottom) => top === bottom - 1 ? { done: true } : { done: false, note: top > bottom - 1 ? 'over' : 'short' }), ends: true },
|
|
35
|
+
// Two rows show no numbers, and the reader sets the sign between them. Each of the three signs is the true one in
|
|
36
|
+
// one draw of three, and the tile opens on one of the two false signs. A wrong check says in which direction the
|
|
37
|
+
// top row is off, with the signs in the order <, =, >.
|
|
38
|
+
'right-sign': {
|
|
39
|
+
scenes: ['match'],
|
|
40
|
+
problem(c) {
|
|
41
|
+
const stop = extra(c, ['rows', 'apart']);
|
|
42
|
+
if (stop) return stop;
|
|
43
|
+
if (!range(c.rows, ROWS)) return `rows is ${words(c.rows)}, write the range of both rows as [low, high] from ${ROWS[0]} to ${ROWS[1]}, such as [4, 10]`;
|
|
44
|
+
if (!range(c.apart, [1, ROWS[1]])) return `apart is ${words(c.apart)}, write how far two different rows stand apart as [low, high] from 1, such as [1, 3]`;
|
|
45
|
+
return c.rows[1] - c.rows[0] >= c.apart[0] ? null : `apart starts at ${c.apart[0]}, and rows from ${c.rows[0]} to ${c.rows[1]} hold no two rows that far apart, so the signs < and > have nothing to draw`;
|
|
46
|
+
},
|
|
47
|
+
draw(c, spec, dice) {
|
|
48
|
+
const sign = dice.pick(SIGNS), far = span(c.rows).flatMap(a => span(c.apart).filter(d => a + d <= c.rows[1]).map(d => [a, a + d]));
|
|
49
|
+
const [less, more] = sign === '=' ? Array(2).fill(dice.pick(span(c.rows))) : dice.pick(far);
|
|
50
|
+
const [top, bottom] = sign === '>' ? [more, less] : [less, more];
|
|
51
|
+
return { top, bottom, wide: dice.pick(['top', 'bottom']), opens: dice.pick(SIGNS.filter(x => x !== sign)) };
|
|
52
|
+
},
|
|
53
|
+
page: t => ({ top: t.top, bottom: t.bottom, wide: t.wide, sign: t.opens, hidden: true }),
|
|
54
|
+
holds(state, spec, c, t) {
|
|
55
|
+
if (!state.checked) return { done: false };
|
|
56
|
+
const want = signOf(state.top, state.bottom);
|
|
57
|
+
return state.sign === want ? { done: true } : { done: false, note: SIGNS.indexOf(want) > SIGNS.indexOf(state.sign) ? 'more' : 'fewer' };
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// The reader's state as a challenge opens: the drawn rows, the sign the tile opens on, and nothing checked.
|
|
63
|
+
export const matchStart = (spec, t) => ({ checked: false, top: t.top, bottom: t.bottom, sign: t.opens ?? null });
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// What a match page holds and what it counts: two rows of objects and the pairs between them. The build and the
|
|
2
|
+
// browser both use this file, so a page's text and its live values agree.
|
|
3
|
+
import { isTile, signShown, readingKey, verdictKey } from './reading.js';
|
|
4
|
+
import { MINUS } from '../../kit/written.js';
|
|
5
|
+
|
|
6
|
+
// A page draws its rows as counters, as cups on a tray above saucers on a table, as the players and the chairs of
|
|
7
|
+
// a game of musical chairs, or as the two scores of a scoreboard with a ball for each goal.
|
|
8
|
+
export const MATCH_LOOKS = ['rows', 'cups', 'chairs', 'scoreboard'];
|
|
9
|
+
export const GOALS_MAX = 9; // A score of the scoreboard stops here.
|
|
10
|
+
export const ROWS = ['top', 'bottom'];
|
|
11
|
+
export const ROW_MAX = 12; // The counters one row holds, which fit the width of a phone.
|
|
12
|
+
export const SPREAD_MAX = 6; // A row that spreads to twice its length holds this many.
|
|
13
|
+
export const PLAYERS = [2, 10]; // The players a game of musical chairs opens with.
|
|
14
|
+
|
|
15
|
+
// The most counters a row can reach on a page: the top of its stepper, or its number. A bottom row that trails the
|
|
16
|
+
// top row reaches as far as the top row.
|
|
17
|
+
export const roomOf = (spec, row) => spec.trail && spec.topCtl ? Math.max(spec.topCtl.hi, spec.bottom) : spec[`${row}Ctl`]?.hi ?? spec[row];
|
|
18
|
+
|
|
19
|
+
// opening gives the rows as the page opens. lines holds each pair the reader drew as [top, bottom], counted from 0.
|
|
20
|
+
// said holds the ids of the counters the reader numbered, in the order of their numbers. base keeps the rows as the
|
|
21
|
+
// page opened, and music says whether the music of the chairs plays.
|
|
22
|
+
export const opening = spec => ({ top: spec.top, bottom: spec.bottom, lines: [], said: [], base: { top: spec.top, bottom: spec.bottom }, music: true, sign: isTile(spec) ? spec.sign : null });
|
|
23
|
+
export const idOf = (row, i) => `${row[0]}${i}`;
|
|
24
|
+
|
|
25
|
+
// linesOf gives the pairs of the rows. An auto page pairs the first counter of the top row with the first of the
|
|
26
|
+
// bottom row and on, and so do the chairs once the music has stopped.
|
|
27
|
+
export function linesOf(spec, s) {
|
|
28
|
+
if (spec.look === 'chairs' ? !s.music : spec.pair === 'auto') return Array.from({ length: Math.min(s.top, s.bottom) }, (_, i) => [i, i]);
|
|
29
|
+
return s.lines;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// resize sets a row to n counters. A counter that leaves takes its line with it, and the numbers come off.
|
|
33
|
+
export function resize(s, row, n) {
|
|
34
|
+
const next = { ...s, [row]: n, said: [] };
|
|
35
|
+
return { ...next, lines: s.lines.filter(([t, b]) => t < next.top && b < next.bottom) };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// step sets a row to n counters after a press on its stepper. On a trail page the bottom row first takes the number
|
|
39
|
+
// the top row had.
|
|
40
|
+
export const step = (spec, s, row, n) => resize(spec.trail ? resize(s, 'bottom', s.top) : s, row, n);
|
|
41
|
+
|
|
42
|
+
// lone lists the counters of each row without a partner. They take a ring once one row has none left to pair. The
|
|
43
|
+
// players take theirs when the music stops, and the last player of a game takes a crown in its place. The balls of
|
|
44
|
+
// a scoreboard take none.
|
|
45
|
+
export function lone(spec, s) {
|
|
46
|
+
const lines = linesOf(spec, s), free = (n, k) => Array.from({ length: n }, (_, i) => i).filter(i => !lines.some(l => l[k] === i));
|
|
47
|
+
const top = free(s.top, 0), bottom = free(s.bottom, 1);
|
|
48
|
+
return { top, bottom, ringed: spec.look === 'scoreboard' ? false : spec.look === 'chairs' ? !s.music && s.bottom > 0 : !top.length || !bottom.length };
|
|
49
|
+
}
|
|
50
|
+
// A game of musical chairs is won when one player is left.
|
|
51
|
+
export const won = (spec, s) => spec.look === 'chairs' && s.top === 1;
|
|
52
|
+
|
|
53
|
+
// counts gives every number a page can show. added and taken count the counters that came and went since the page
|
|
54
|
+
// opened, over both rows, and counted is the last number the reader said.
|
|
55
|
+
export function counts(spec, s) {
|
|
56
|
+
const l = lone(spec, s), moved = sign => ROWS.reduce((sum, row) => sum + Math.max(0, sign * (s[row] - s.base[row])), 0);
|
|
57
|
+
return { unpaired: l.top.length + l.bottom.length, pairs: linesOf(spec, s).length, top: s.top, bottom: s.bottom,
|
|
58
|
+
counted: s.said.length, added: moved(1), taken: moved(-1) };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// The two groups are the same when each row has a counter and every counter has a partner.
|
|
62
|
+
export const same = (spec, s) => s.top > 0 && s.bottom > 0 && counts(spec, s).unpaired === 0;
|
|
63
|
+
|
|
64
|
+
// wordsOf gives the tag of each row: the row with counters left over has more, the other has fewer, and rows whose
|
|
65
|
+
// every counter has a partner are the same. n is how many more, once the reader has numbered every counter left over.
|
|
66
|
+
export function wordsOf(spec, s) {
|
|
67
|
+
const l = lone(spec, s), left = l.top.length + l.bottom.length;
|
|
68
|
+
if (!left) return { top: { word: 'same' }, bottom: { word: 'same' } };
|
|
69
|
+
const n = spec.tap && s.said.length === left ? left : null, more = l.top.length ? 'top' : 'bottom';
|
|
70
|
+
return Object.fromEntries(ROWS.map(row => [row, { word: row === more ? 'more' : 'fewer', n }]));
|
|
71
|
+
}
|
|
72
|
+
// The string of a tag, which takes n when the tag holds a number.
|
|
73
|
+
export const tagKey = w => w.n == null ? `tag-${w.word}` : `tag-${w.word}-n`;
|
|
74
|
+
|
|
75
|
+
// The measures a page can read out and link in its text. The words of the tags are linked and take no readout.
|
|
76
|
+
export function measuresOf(spec) {
|
|
77
|
+
if (spec.challenge) return [];
|
|
78
|
+
const signed = [...(spec.sign ? ['reading'] : []), ...(isTile(spec) ? ['verdict'] : []), ...(spec.written ? ['written', 'reading'] : [])];
|
|
79
|
+
if (spec.look === 'chairs' || spec.look === 'scoreboard') return ['top', 'bottom', ...signed];
|
|
80
|
+
return ['unpaired', 'pairs', 'top', 'bottom', ...signed, ...(spec.tap ? ['counted'] : []), ...(spec.trace ? ['added', 'taken'] : [])];
|
|
81
|
+
}
|
|
82
|
+
export const wordsLinked = spec => spec.word === true ? ['top-word', 'bottom-word'] : [];
|
|
83
|
+
// The strings of the line of words and of the mark of a page with a sign, as the page stands.
|
|
84
|
+
export const readingOf = (spec, s) => readingKey(s.top, s.bottom, signShown(spec, s));
|
|
85
|
+
export const verdictOf = (spec, s) => verdictKey(s.top, s.bottom, signShown(spec, s));
|
|
86
|
+
|
|
87
|
+
// differenceOf gives the written line of the difference of the rows: the greater row's number minus the less row's,
|
|
88
|
+
// with its answer once one row has every counter paired, when the counters left over take their rings. greater
|
|
89
|
+
// names the row whose number comes first, the top row when the rows are equal.
|
|
90
|
+
export function differenceOf(spec, s) {
|
|
91
|
+
const greater = s.bottom > s.top ? 'bottom' : 'top', less = greater === 'top' ? 'bottom' : 'top';
|
|
92
|
+
return { line: { a: s[greater], sign: MINUS, b: s[less], open: !lone(spec, s).ringed }, greater, less };
|
|
93
|
+
}
|