trackler 1.0.4.0 → 1.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/CONTRIBUTING.md +17 -2
- data/common/exercises/anagram/canonical-data.json +0 -14
- data/common/exercises/pig-latin/canonical-data.json +6 -1
- data/common/exercises/raindrops/description.md +4 -4
- data/common/exercises/raindrops/metadata.yml +1 -1
- data/common/exercises/roman-numerals/metadata.yml +1 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/config.json +12 -1
- data/tracks/c/exercises/roman-numerals/makefile +16 -0
- data/tracks/c/exercises/roman-numerals/src/example.c +43 -0
- data/tracks/c/exercises/roman-numerals/src/example.h +6 -0
- data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +126 -0
- data/tracks/c/exercises/roman-numerals/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/roman-numerals/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/roman-numerals/test/vendor/unity_internals.h +701 -0
- data/tracks/clojure/exercises/flatten-array/project.clj +4 -0
- data/tracks/csharp/exercises/protein-translation/ProteinTranslationTest.cs +1 -1
- data/tracks/elixir/exercises/bowling/bowling_test.exs +157 -62
- data/tracks/elixir/exercises/bowling/example.exs +33 -4
- data/tracks/erlang/config.json +176 -36
- data/tracks/go/.travis.yml +7 -1
- data/tracks/go/bin/test-without-stubs +29 -0
- data/tracks/go/exercises/robot-simulator/defs.go +1 -1
- data/tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go +31 -25
- data/tracks/haskell/.travis.yml +9 -5
- data/tracks/haskell/config.json +127 -121
- data/tracks/haskell/exercises/leap/src/LeapYear.hs +1 -1
- data/tracks/haskell/exercises/space-age/HINTS.md +14 -2
- data/tracks/haskell/exercises/space-age/{src/Example.hs → examples/success-double/SpaceAge.hs} +0 -0
- data/tracks/haskell/exercises/space-age/examples/success-double/package.yaml +19 -0
- data/tracks/haskell/exercises/space-age/examples/success-rational/SpaceAge.hs +24 -0
- data/tracks/haskell/exercises/space-age/examples/success-rational/package.yaml +19 -0
- data/tracks/haskell/exercises/space-age/src/SpaceAge.hs +4 -1
- data/tracks/haskell/exercises/space-age/test/Tests.hs +12 -5
- data/tracks/haskell/exercises/word-count/HINTS.md +21 -0
- data/tracks/haskell/exercises/word-count/examples/success-newtype/WordCount.hs +31 -0
- data/tracks/haskell/exercises/word-count/examples/success-newtype/package.yaml +21 -0
- data/tracks/haskell/exercises/word-count/examples/success-simple/WordCount.hs +13 -0
- data/tracks/haskell/exercises/word-count/examples/success-simple/package.yaml +20 -0
- data/tracks/haskell/exercises/word-count/package.yaml +0 -2
- data/tracks/haskell/exercises/word-count/src/WordCount.hs +2 -1
- data/tracks/haskell/exercises/word-count/test/Tests.hs +15 -6
- data/tracks/haskell/exercises/zebra-puzzle/package.yaml +19 -0
- data/tracks/haskell/exercises/zebra-puzzle/src/Example.hs +113 -0
- data/tracks/haskell/exercises/zebra-puzzle/src/ZebraPuzzle.hs +12 -0
- data/tracks/haskell/exercises/zebra-puzzle/stack.yaml +1 -0
- data/tracks/haskell/exercises/zebra-puzzle/test/Tests.hs +13 -0
- data/tracks/javascript/exercises/beer-song/beer-song.spec.js +5 -0
- data/tracks/lisp/config.json +147 -0
- data/tracks/ocaml/config.json +12 -0
- data/tracks/ocaml/exercises/atbash-cipher/.merlin +5 -0
- data/tracks/ocaml/exercises/atbash-cipher/HINTS.md +17 -0
- data/tracks/ocaml/exercises/atbash-cipher/Makefile +11 -0
- data/tracks/ocaml/exercises/atbash-cipher/atbash_cipher.mli +5 -0
- data/tracks/ocaml/exercises/atbash-cipher/example.ml +47 -0
- data/tracks/ocaml/exercises/atbash-cipher/test.ml +37 -0
- data/tracks/ocaml/exercises/meetup/.merlin +5 -0
- data/tracks/ocaml/exercises/meetup/Makefile +11 -0
- data/tracks/ocaml/exercises/meetup/example.ml +63 -0
- data/tracks/ocaml/exercises/meetup/meetup.mli +7 -0
- data/tracks/ocaml/exercises/meetup/test.ml +786 -0
- data/tracks/php/exercises/bowling/bowling_test.php +233 -10
- data/tracks/php/exercises/bowling/example.php +49 -6
- data/tracks/python/.travis.yml +5 -0
- data/tracks/python/config.json +33 -1
- data/tracks/python/exercises/flatten-array/example.py +18 -0
- data/tracks/python/exercises/flatten-array/flatten_array_test.py +40 -0
- data/tracks/python/exercises/robot-name/robot_name_test.py +8 -2
- data/tracks/r/config.json +32 -8
- data/tracks/ruby/bin/enable-executable +9 -5
- data/tracks/ruby/bin/executable-tests-check +7 -3
- data/tracks/ruby/bin/local-status-check +4 -4
- data/tracks/ruby/config.json +8 -1
- data/tracks/ruby/exercises/acronym/acronym_test.rb +0 -1
- data/tracks/ruby/exercises/anagram/.version +1 -0
- data/tracks/ruby/exercises/anagram/anagram_test.rb +101 -31
- data/tracks/ruby/exercises/anagram/example.rb +4 -0
- data/tracks/ruby/exercises/anagram/example.tt +19 -0
- data/tracks/ruby/exercises/gigasecond/.version +1 -1
- data/tracks/ruby/exercises/gigasecond/example.rb +1 -1
- data/tracks/ruby/exercises/gigasecond/gigasecond_test.rb +2 -2
- data/tracks/ruby/exercises/isogram/.version +1 -0
- data/tracks/ruby/exercises/isogram/example.rb +10 -0
- data/tracks/ruby/exercises/isogram/example.tt +20 -0
- data/tracks/ruby/exercises/isogram/isogram_test.rb +90 -0
- data/tracks/ruby/exercises/poker/example.rb +97 -39
- data/tracks/ruby/exercises/poker/poker_test.rb +67 -36
- data/tracks/ruby/exercises/sieve/.version +1 -0
- data/tracks/ruby/exercises/sieve/example.rb +4 -0
- data/tracks/ruby/exercises/sieve/example.tt +21 -0
- data/tracks/ruby/exercises/sieve/sieve_test.rb +36 -13
- data/tracks/ruby/exercises/word-count/example.tt +4 -3
- data/tracks/ruby/exercises/word-count/word_count_test.rb +38 -48
- data/tracks/ruby/lib/anagram_cases.rb +42 -0
- data/tracks/ruby/lib/isogram_cases.rb +24 -0
- data/tracks/ruby/lib/sieve_cases.rb +33 -0
- data/tracks/ruby/lib/word_count_cases.rb +19 -0
- data/tracks/scala/config.json +21 -0
- data/tracks/scala/docs/RESOURCES.md +1 -0
- data/tracks/scala/exercises/bracket-push/build.sbt +4 -0
- data/tracks/scala/exercises/bracket-push/example.scala +23 -0
- data/tracks/scala/exercises/bracket-push/src/main/scala/.keep +0 -0
- data/tracks/scala/exercises/bracket-push/src/test/scala/BracketsTest.scala +68 -0
- data/tracks/scala/exercises/change/src/test/scala/ChangeTest.scala +7 -0
- data/tracks/scala/exercises/sgf-parsing/build.sbt +7 -0
- data/tracks/scala/exercises/sgf-parsing/example.scala +66 -0
- data/tracks/scala/exercises/sgf-parsing/src/main/scala/.keep +0 -0
- data/tracks/scala/exercises/sgf-parsing/src/main/scala/Sgf.scala +17 -0
- data/tracks/scala/exercises/sgf-parsing/src/test/scala/SgfTest.scala +66 -0
- data/tracks/scala/exercises/zebra-puzzle/build.sbt +3 -0
- data/tracks/scala/exercises/zebra-puzzle/example.scala +152 -0
- data/tracks/scala/exercises/zebra-puzzle/src/main/scala/.keep +0 -0
- data/tracks/scala/exercises/zebra-puzzle/src/main/scala/ZebraPuzzle.scala +14 -0
- data/tracks/scala/exercises/zebra-puzzle/src/test/scala/ZebraPuzzleTest.scala +11 -0
- data/tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala +44 -0
- metadata +63 -3
- data/tracks/haskell/exercises/word-count/src/Example.hs +0 -8
@@ -78,6 +78,6 @@ public class ProteinTranslationTest
|
|
78
78
|
[Ignore("Remove to run test")]
|
79
79
|
public void Throws_for_invalid_codons()
|
80
80
|
{
|
81
|
-
Assert.
|
81
|
+
Assert.That(() => ProteinTranslation.Translate("CARROT"), Throws.Exception);
|
82
82
|
}
|
83
83
|
}
|
@@ -29,9 +29,26 @@ defmodule BowlingTest do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
@tag :pending
|
32
|
-
test "can score
|
32
|
+
test "can score a game with no strikes or spares" do
|
33
33
|
game = Bowling.start
|
34
|
-
rolls = [3,
|
34
|
+
rolls = [3, 6,
|
35
|
+
3, 6,
|
36
|
+
3, 6,
|
37
|
+
3, 6,
|
38
|
+
3, 6,
|
39
|
+
3, 6,
|
40
|
+
3, 6,
|
41
|
+
3, 6,
|
42
|
+
3, 6,
|
43
|
+
3, 6]
|
44
|
+
game = roll_reduce(game, rolls)
|
45
|
+
assert Bowling.score(game) == 90
|
46
|
+
end
|
47
|
+
|
48
|
+
@tag :pending
|
49
|
+
test "spare followed by all 0s is worth 10 points" do
|
50
|
+
game = Bowling.start
|
51
|
+
rolls = [6, 4,
|
35
52
|
0, 0,
|
36
53
|
0, 0,
|
37
54
|
0, 0,
|
@@ -42,15 +59,15 @@ defmodule BowlingTest do
|
|
42
59
|
0, 0,
|
43
60
|
0, 0]
|
44
61
|
game = roll_reduce(game, rolls)
|
45
|
-
assert Bowling.score(game) ==
|
62
|
+
assert Bowling.score(game) == 10
|
46
63
|
end
|
47
64
|
|
48
65
|
@tag :pending
|
49
|
-
test "
|
66
|
+
test "points scored in the roll after the spare are counted twice" do
|
50
67
|
game = Bowling.start
|
51
|
-
rolls = [
|
52
|
-
|
53
|
-
|
68
|
+
rolls = [6, 4,
|
69
|
+
3, 0,
|
70
|
+
0, 0,
|
54
71
|
0, 0,
|
55
72
|
0, 0,
|
56
73
|
0, 0,
|
@@ -59,48 +76,49 @@ defmodule BowlingTest do
|
|
59
76
|
0, 0,
|
60
77
|
0, 0]
|
61
78
|
game = roll_reduce(game, rolls)
|
62
|
-
assert Bowling.score(game) ==
|
79
|
+
assert Bowling.score(game) == 16
|
63
80
|
end
|
64
81
|
|
65
82
|
@tag :pending
|
66
|
-
test "
|
83
|
+
test "consecutive spares each get a one roll bonus" do
|
67
84
|
game = Bowling.start
|
68
|
-
rolls = [
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
85
|
+
rolls = [5, 5,
|
86
|
+
3, 7,
|
87
|
+
4, 0,
|
88
|
+
0, 0,
|
89
|
+
0, 0,
|
90
|
+
0, 0,
|
91
|
+
0, 0,
|
92
|
+
0, 0,
|
93
|
+
0, 0,
|
94
|
+
0, 0]
|
78
95
|
game = roll_reduce(game, rolls)
|
79
|
-
assert Bowling.score(game) ==
|
96
|
+
assert Bowling.score(game) == 31
|
80
97
|
end
|
81
98
|
|
82
99
|
@tag :pending
|
83
|
-
test "
|
100
|
+
test "a spare in the last frame gets a one roll bonus that is counted once" do
|
84
101
|
game = Bowling.start
|
85
|
-
rolls = [
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
3,
|
102
|
+
rolls = [0, 0,
|
103
|
+
0, 0,
|
104
|
+
0, 0,
|
105
|
+
0, 0,
|
106
|
+
0, 0,
|
107
|
+
0, 0,
|
108
|
+
0, 0,
|
109
|
+
0, 0,
|
110
|
+
0, 0,
|
111
|
+
7, 3,
|
112
|
+
7]
|
95
113
|
game = roll_reduce(game, rolls)
|
96
|
-
assert Bowling.score(game) ==
|
114
|
+
assert Bowling.score(game) == 17
|
97
115
|
end
|
98
116
|
|
99
117
|
@tag :pending
|
100
|
-
test "
|
118
|
+
test "a strike earns ten points in frame with a single roll" do
|
101
119
|
game = Bowling.start
|
102
120
|
rolls = [10,
|
103
|
-
|
121
|
+
0, 0,
|
104
122
|
0, 0,
|
105
123
|
0, 0,
|
106
124
|
0, 0,
|
@@ -110,14 +128,14 @@ defmodule BowlingTest do
|
|
110
128
|
0, 0,
|
111
129
|
0, 0]
|
112
130
|
game = roll_reduce(game, rolls)
|
113
|
-
assert Bowling.score(game) ==
|
131
|
+
assert Bowling.score(game) == 10
|
114
132
|
end
|
115
133
|
|
116
134
|
@tag :pending
|
117
|
-
test "
|
135
|
+
test "points scored in the two rolls after a strike are counted twice as a bonus" do
|
118
136
|
game = Bowling.start
|
119
|
-
rolls = [
|
120
|
-
|
137
|
+
rolls = [10,
|
138
|
+
5, 3,
|
121
139
|
0, 0,
|
122
140
|
0, 0,
|
123
141
|
0, 0,
|
@@ -127,11 +145,11 @@ defmodule BowlingTest do
|
|
127
145
|
0, 0,
|
128
146
|
0, 0]
|
129
147
|
game = roll_reduce(game, rolls)
|
130
|
-
assert Bowling.score(game) ==
|
148
|
+
assert Bowling.score(game) == 26
|
131
149
|
end
|
132
150
|
|
133
151
|
@tag :pending
|
134
|
-
test "
|
152
|
+
test "consecutive strikes each get the two roll bonus" do
|
135
153
|
game = Bowling.start
|
136
154
|
rolls = [10,
|
137
155
|
10,
|
@@ -148,24 +166,25 @@ defmodule BowlingTest do
|
|
148
166
|
end
|
149
167
|
|
150
168
|
@tag :pending
|
151
|
-
test "
|
169
|
+
test "a strike in the last frame gets a two roll bonus that is counted once" do
|
152
170
|
game = Bowling.start
|
153
|
-
rolls = [
|
154
|
-
3, 7,
|
155
|
-
4, 1,
|
171
|
+
rolls = [0, 0,
|
156
172
|
0, 0,
|
157
173
|
0, 0,
|
158
174
|
0, 0,
|
159
175
|
0, 0,
|
160
176
|
0, 0,
|
161
177
|
0, 0,
|
162
|
-
0, 0
|
178
|
+
0, 0,
|
179
|
+
0, 0,
|
180
|
+
10,
|
181
|
+
7, 1]
|
163
182
|
game = roll_reduce(game, rolls)
|
164
|
-
assert Bowling.score(game) ==
|
183
|
+
assert Bowling.score(game) == 18
|
165
184
|
end
|
166
185
|
|
167
186
|
@tag :pending
|
168
|
-
test "
|
187
|
+
test "rolling a spare with the two roll bonus does not get a bonus roll" do
|
169
188
|
game = Bowling.start
|
170
189
|
rolls = [0, 0,
|
171
190
|
0, 0,
|
@@ -177,13 +196,13 @@ defmodule BowlingTest do
|
|
177
196
|
0, 0,
|
178
197
|
0, 0,
|
179
198
|
10,
|
180
|
-
7,
|
199
|
+
7, 3]
|
181
200
|
game = roll_reduce(game, rolls)
|
182
|
-
assert Bowling.score(game) ==
|
201
|
+
assert Bowling.score(game) == 20
|
183
202
|
end
|
184
203
|
|
185
204
|
@tag :pending
|
186
|
-
test "
|
205
|
+
test "strikes with the two roll bonus do not get bonus rolls" do
|
187
206
|
game = Bowling.start
|
188
207
|
rolls = [0, 0,
|
189
208
|
0, 0,
|
@@ -194,14 +213,15 @@ defmodule BowlingTest do
|
|
194
213
|
0, 0,
|
195
214
|
0, 0,
|
196
215
|
0, 0,
|
197
|
-
|
198
|
-
|
216
|
+
10,
|
217
|
+
10,
|
218
|
+
10]
|
199
219
|
game = roll_reduce(game, rolls)
|
200
|
-
assert Bowling.score(game) ==
|
220
|
+
assert Bowling.score(game) == 30
|
201
221
|
end
|
202
222
|
|
203
223
|
@tag :pending
|
204
|
-
test "
|
224
|
+
test "a strike with the one roll bonus after a spare in the last frame does not get a bonus" do
|
205
225
|
game = Bowling.start
|
206
226
|
rolls = [0, 0,
|
207
227
|
0, 0,
|
@@ -212,15 +232,14 @@ defmodule BowlingTest do
|
|
212
232
|
0, 0,
|
213
233
|
0, 0,
|
214
234
|
0, 0,
|
215
|
-
|
216
|
-
10,
|
235
|
+
7, 3,
|
217
236
|
10]
|
218
237
|
game = roll_reduce(game, rolls)
|
219
|
-
assert Bowling.score(game) ==
|
238
|
+
assert Bowling.score(game) == 20
|
220
239
|
end
|
221
240
|
|
222
241
|
@tag :pending
|
223
|
-
test "
|
242
|
+
test "all strikes is a perfect game" do
|
224
243
|
game = Bowling.start
|
225
244
|
rolls = [10,
|
226
245
|
10,
|
@@ -239,26 +258,26 @@ defmodule BowlingTest do
|
|
239
258
|
end
|
240
259
|
|
241
260
|
@tag :pending
|
242
|
-
test "
|
261
|
+
test "rolls can not score negative points" do
|
243
262
|
game = Bowling.start
|
244
263
|
assert Bowling.roll(game, -1) == {:error, "Pins must have a value from 0 to 10"}
|
245
264
|
end
|
246
265
|
|
247
266
|
@tag :pending
|
248
|
-
test "
|
267
|
+
test "a roll can not score more than 10 points" do
|
249
268
|
game = Bowling.start
|
250
269
|
assert Bowling.roll(game, 11) == {:error, "Pins must have a value from 0 to 10"}
|
251
270
|
end
|
252
271
|
|
253
272
|
@tag :pending
|
254
|
-
test "
|
273
|
+
test "two rolls in a frame can not score more than 10 points" do
|
255
274
|
game = Bowling.start
|
256
275
|
game = Bowling.roll(game, 5)
|
257
276
|
assert Bowling.roll(game, 6) == {:error, "Pin count exceeds pins on the lane"}
|
258
277
|
end
|
259
278
|
|
260
279
|
@tag :pending
|
261
|
-
test "
|
280
|
+
test "two bonus rolls after a strike in the last frame can not score more than 10 points" do
|
262
281
|
game = Bowling.start
|
263
282
|
rolls = [0, 0,
|
264
283
|
0, 0,
|
@@ -274,10 +293,86 @@ defmodule BowlingTest do
|
|
274
293
|
assert Bowling.roll(game, 6) == {:error, "Pin count exceeds pins on the lane"}
|
275
294
|
end
|
276
295
|
|
296
|
+
@tag :pending
|
297
|
+
test "an unstarted game can not be scored" do
|
298
|
+
game = Bowling.start
|
299
|
+
assert Bowling.score(game) == {:error, "Score cannot be taken until the end of the game"}
|
300
|
+
end
|
301
|
+
|
277
302
|
@tag :pending
|
278
303
|
test "score cannot be taken until the end of the game" do
|
279
304
|
game = Bowling.start
|
280
305
|
game = Bowling.roll(game, 0)
|
281
306
|
assert Bowling.score(game) == {:error, "Score cannot be taken until the end of the game"}
|
282
307
|
end
|
308
|
+
|
309
|
+
@tag :pending
|
310
|
+
test "a game with more than ten frames can not be scored" do
|
311
|
+
game = Bowling.start
|
312
|
+
rolls = [0, 0,
|
313
|
+
0, 0,
|
314
|
+
0, 0,
|
315
|
+
0, 0,
|
316
|
+
0, 0,
|
317
|
+
0, 0,
|
318
|
+
0, 0,
|
319
|
+
0, 0,
|
320
|
+
0, 0,
|
321
|
+
0, 0,
|
322
|
+
0]
|
323
|
+
game = roll_reduce(game, rolls)
|
324
|
+
assert Bowling.score(game) == {:error, "Invalid game: too many frames"}
|
325
|
+
end
|
326
|
+
|
327
|
+
@tag :pending
|
328
|
+
test "bonus rolls for a strike in the last frame must be rolled before score can be calculated" do
|
329
|
+
game = Bowling.start
|
330
|
+
rolls = [0, 0,
|
331
|
+
0, 0,
|
332
|
+
0, 0,
|
333
|
+
0, 0,
|
334
|
+
0, 0,
|
335
|
+
0, 0,
|
336
|
+
0, 0,
|
337
|
+
0, 0,
|
338
|
+
0, 0,
|
339
|
+
10]
|
340
|
+
game = roll_reduce(game, rolls)
|
341
|
+
assert Bowling.score(game) == {:error, "Score cannot be taken until the end of the game"}
|
342
|
+
end
|
343
|
+
|
344
|
+
@tag :pending
|
345
|
+
test "both bonus rolls for a strike in the last frame must be rolled before score can be calculated" do
|
346
|
+
game = Bowling.start
|
347
|
+
rolls = [0, 0,
|
348
|
+
0, 0,
|
349
|
+
0, 0,
|
350
|
+
0, 0,
|
351
|
+
0, 0,
|
352
|
+
0, 0,
|
353
|
+
0, 0,
|
354
|
+
0, 0,
|
355
|
+
0, 0,
|
356
|
+
10,
|
357
|
+
10]
|
358
|
+
game = roll_reduce(game, rolls)
|
359
|
+
assert Bowling.score(game) == {:error, "Score cannot be taken until the end of the game"}
|
360
|
+
end
|
361
|
+
|
362
|
+
@tag :pending
|
363
|
+
test "bonus roll for a spare in the last frame must be rolled before score can be calculated" do
|
364
|
+
game = Bowling.start
|
365
|
+
rolls = [0, 0,
|
366
|
+
0, 0,
|
367
|
+
0, 0,
|
368
|
+
0, 0,
|
369
|
+
0, 0,
|
370
|
+
0, 0,
|
371
|
+
0, 0,
|
372
|
+
0, 0,
|
373
|
+
0, 0,
|
374
|
+
7, 3]
|
375
|
+
game = roll_reduce(game, rolls)
|
376
|
+
assert Bowling.score(game) == {:error, "Score cannot be taken until the end of the game"}
|
377
|
+
end
|
283
378
|
end
|
@@ -53,10 +53,39 @@ defmodule Bowling do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def score(game) do
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
cond do
|
57
|
+
game.current_frame < 10 ->
|
58
|
+
{:error, "Score cannot be taken until the end of the game"}
|
59
|
+
bonus_roll_remaining?(game) ->
|
60
|
+
{:error, "Score cannot be taken until the end of the game"}
|
61
|
+
too_many_frames?(game) ->
|
62
|
+
{:error, "Invalid game: too many frames"}
|
63
|
+
true ->
|
64
|
+
parse_scores(game.scores)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
defp bonus_roll_remaining?(game) do
|
69
|
+
final_frame = Enum.at(game.scores, 9)
|
70
|
+
cond do
|
71
|
+
strike?(final_frame) ->
|
72
|
+
cond do
|
73
|
+
strike?(Enum.at(game.scores, 10)) ->
|
74
|
+
game.current_frame == 12 && game.roll_in_frame == 1
|
75
|
+
true ->
|
76
|
+
game.current_frame < 12
|
77
|
+
end
|
78
|
+
spare?(final_frame) ->
|
79
|
+
game.current_frame == 11 && game.roll_in_frame == 1
|
80
|
+
true ->
|
81
|
+
false
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
defp too_many_frames?(game) do
|
86
|
+
final_frame = Enum.at(game.scores, 9)
|
87
|
+
unless strike?(final_frame) || spare?(final_frame) do
|
88
|
+
game.current_frame == 11 && game.roll_in_frame == 2
|
60
89
|
end
|
61
90
|
end
|
62
91
|
|
data/tracks/erlang/config.json
CHANGED
@@ -3,42 +3,182 @@
|
|
3
3
|
"language": "Erlang",
|
4
4
|
"repository": "https://github.com/exercism/xerlang",
|
5
5
|
"active": true,
|
6
|
-
"
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
6
|
+
"exercises": [
|
7
|
+
{
|
8
|
+
"slug": "hello-world",
|
9
|
+
"topics": [],
|
10
|
+
"difficulty": 1
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"slug": "leap",
|
14
|
+
"topics": [],
|
15
|
+
"difficulty": 1
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"slug": "rna-transcription",
|
19
|
+
"topics": [],
|
20
|
+
"difficulty": 1
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"slug": "accumulate",
|
24
|
+
"topics": [],
|
25
|
+
"difficulty": 1
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"slug": "bob",
|
29
|
+
"topics": [],
|
30
|
+
"difficulty": 1
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"slug": "sum-of-multiples",
|
34
|
+
"topics": [],
|
35
|
+
"difficulty": 1
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"slug": "strain",
|
39
|
+
"topics": [],
|
40
|
+
"difficulty": 1
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"slug": "hamming",
|
44
|
+
"topics": [],
|
45
|
+
"difficulty": 1
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"slug": "space-age",
|
49
|
+
"topics": [],
|
50
|
+
"difficulty": 1
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"slug": "grains",
|
54
|
+
"topics": [],
|
55
|
+
"difficulty": 1
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"slug": "anagram",
|
59
|
+
"topics": [],
|
60
|
+
"difficulty": 1
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"slug": "nucleotide-count",
|
64
|
+
"topics": [],
|
65
|
+
"difficulty": 1
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"slug": "atbash-cipher",
|
69
|
+
"topics": [],
|
70
|
+
"difficulty": 1
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"slug": "phone-number",
|
74
|
+
"topics": [],
|
75
|
+
"difficulty": 1
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"slug": "robot-simulator",
|
79
|
+
"topics": [],
|
80
|
+
"difficulty": 1
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"slug": "grade-school",
|
84
|
+
"topics": [],
|
85
|
+
"difficulty": 1
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"slug": "binary",
|
89
|
+
"topics": [],
|
90
|
+
"difficulty": 1
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"slug": "word-count",
|
94
|
+
"topics": [],
|
95
|
+
"difficulty": 1
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"slug": "circular-buffer",
|
99
|
+
"topics": [],
|
100
|
+
"difficulty": 1
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"slug": "etl",
|
104
|
+
"topics": [],
|
105
|
+
"difficulty": 1
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"slug": "clock",
|
109
|
+
"topics": [],
|
110
|
+
"difficulty": 1
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"slug": "gigasecond",
|
114
|
+
"topics": [],
|
115
|
+
"difficulty": 1
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"slug": "beer-song",
|
119
|
+
"topics": [],
|
120
|
+
"difficulty": 1
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"slug": "difference-of-squares",
|
124
|
+
"topics": [],
|
125
|
+
"difficulty": 1
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"slug": "allergies",
|
129
|
+
"topics": [],
|
130
|
+
"difficulty": 1
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"slug": "bank-account",
|
134
|
+
"topics": [],
|
135
|
+
"difficulty": 1
|
136
|
+
},
|
137
|
+
{
|
138
|
+
"slug": "luhn",
|
139
|
+
"topics": [],
|
140
|
+
"difficulty": 1
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"slug": "series",
|
144
|
+
"topics": [],
|
145
|
+
"difficulty": 1
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"slug": "trinary",
|
149
|
+
"topics": [],
|
150
|
+
"difficulty": 1
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"slug": "largest-series-product",
|
154
|
+
"topics": [],
|
155
|
+
"difficulty": 1
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"slug": "meetup",
|
159
|
+
"topics": [],
|
160
|
+
"difficulty": 1
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"slug": "parallel-letter-frequency",
|
164
|
+
"topics": [],
|
165
|
+
"difficulty": 1
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"slug": "triangle",
|
169
|
+
"topics": [],
|
170
|
+
"difficulty": 1
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"slug": "scrabble-score",
|
174
|
+
"topics": [],
|
175
|
+
"difficulty": 1
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"slug": "zipper",
|
179
|
+
"topics": [],
|
180
|
+
"difficulty": 1
|
181
|
+
}
|
42
182
|
],
|
43
183
|
"deprecated": [
|
44
184
|
"point-mutations"
|