trackler 2.2.1.59 → 2.2.1.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/food-chain/canonical-data.json +31 -23
- data/problem-specifications/exercises/house/canonical-data.json +45 -33
- data/problem-specifications/exercises/house/description.md +1 -1
- data/problem-specifications/exercises/kindergarten-garden/description.md +3 -3
- data/problem-specifications/exercises/nucleotide-count/description.md +2 -2
- data/problem-specifications/exercises/palindrome-products/description.md +1 -1
- data/problem-specifications/exercises/rectangles/description.md +9 -9
- data/problem-specifications/exercises/twelve-days/canonical-data.json +171 -0
- data/problem-specifications/exercises/two-bucket/description.md +7 -7
- data/tracks/c/docs/CONTRIBUTING.md +88 -39
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +33 -29
- data/tracks/c/exercises/triangle/src/example.c +12 -12
- data/tracks/c/exercises/triangle/src/example.h +3 -3
- data/tracks/c/exercises/triangle/test/test_triangle.c +16 -16
- data/tracks/c/exercises/word-count/src/example.c +12 -3
- data/tracks/c/exercises/word-count/src/word_count.h +10 -5
- data/tracks/c/exercises/word-count/test/test_word_count.c +248 -58
- data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +3 -3
- data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +2 -2
- data/tracks/dart/exercises/phone-number/README.md +1 -1
- data/tracks/dart/exercises/phone-number/test/phone_number_test.dart +5 -5
- data/tracks/gnu-apl/.dockerignore +5 -0
- data/tracks/gnu-apl/.travis.yml +9 -4
- data/tracks/gnu-apl/Dockerfiles/release.dockerfile +15 -0
- data/tracks/gnu-apl/Dockerfiles/svn.dockerfile +22 -0
- data/tracks/gnu-apl/README.md +1 -1
- data/tracks/gnu-apl/bin/install-apl +26 -0
- data/tracks/gnu-apl/test.apl +7 -6
- data/tracks/go/docs/TESTS.md +1 -1
- data/tracks/haskell/.travis.yml +1 -1
- data/tracks/haskell/config.json +9 -0
- data/tracks/haskell/exercises/accumulate/stack.yaml +1 -1
- data/tracks/haskell/exercises/acronym/package.yaml +1 -1
- data/tracks/haskell/exercises/acronym/stack.yaml +1 -1
- data/tracks/haskell/exercises/acronym/test/Tests.hs +3 -0
- data/tracks/haskell/exercises/all-your-base/stack.yaml +1 -1
- data/tracks/haskell/exercises/allergies/stack.yaml +1 -1
- data/tracks/haskell/exercises/alphametics/examples/success-standard/src/Alphametics.hs +2 -1
- data/tracks/haskell/exercises/alphametics/stack.yaml +1 -1
- data/tracks/haskell/exercises/anagram/stack.yaml +1 -1
- data/tracks/haskell/exercises/atbash-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/bank-account/stack.yaml +1 -1
- data/tracks/haskell/exercises/beer-song/stack.yaml +1 -1
- data/tracks/haskell/exercises/binary-search-tree/stack.yaml +1 -1
- data/tracks/haskell/exercises/binary/stack.yaml +1 -1
- data/tracks/haskell/exercises/bob/stack.yaml +1 -1
- data/tracks/haskell/exercises/bowling/stack.yaml +1 -1
- data/tracks/haskell/exercises/bracket-push/stack.yaml +1 -1
- data/tracks/haskell/exercises/change/stack.yaml +1 -1
- data/tracks/haskell/exercises/clock/stack.yaml +1 -1
- data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -1
- data/tracks/haskell/exercises/complex-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/connect/stack.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/stack.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/test/Tests.hs +9 -5
- data/tracks/haskell/exercises/custom-set/package.yaml +1 -1
- data/tracks/haskell/exercises/custom-set/stack.yaml +1 -1
- data/tracks/haskell/exercises/custom-set/test/Tests.hs +3 -0
- data/tracks/haskell/exercises/diamond/stack.yaml +1 -1
- data/tracks/haskell/exercises/difference-of-squares/stack.yaml +1 -1
- data/tracks/haskell/exercises/dominoes/README.md +3 -3
- data/tracks/haskell/exercises/dominoes/stack.yaml +1 -1
- data/tracks/haskell/exercises/etl/stack.yaml +1 -1
- data/tracks/haskell/exercises/food-chain/stack.yaml +1 -1
- data/tracks/haskell/exercises/forth/stack.yaml +1 -1
- data/tracks/haskell/exercises/gigasecond/stack.yaml +1 -1
- data/tracks/haskell/exercises/go-counting/stack.yaml +1 -1
- data/tracks/haskell/exercises/grade-school/stack.yaml +1 -1
- data/tracks/haskell/exercises/grains/stack.yaml +1 -1
- data/tracks/haskell/exercises/hamming/package.yaml +1 -1
- data/tracks/haskell/exercises/hamming/stack.yaml +1 -1
- data/tracks/haskell/exercises/hamming/test/Tests.hs +4 -4
- data/tracks/haskell/exercises/hello-world/stack.yaml +1 -1
- data/tracks/haskell/exercises/hexadecimal/stack.yaml +1 -1
- data/tracks/haskell/exercises/house/README.md +1 -1
- data/tracks/haskell/exercises/house/stack.yaml +1 -1
- data/tracks/haskell/exercises/isbn-verifier/README.md +96 -0
- data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/src/IsbnVerifier.hs +10 -0
- data/tracks/haskell/exercises/isbn-verifier/package.yaml +20 -0
- data/tracks/haskell/exercises/isbn-verifier/src/IsbnVerifier.hs +4 -0
- data/tracks/haskell/exercises/isbn-verifier/stack.yaml +1 -0
- data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +74 -0
- data/tracks/haskell/exercises/isogram/stack.yaml +1 -1
- data/tracks/haskell/exercises/kindergarten-garden/README.md +3 -3
- data/tracks/haskell/exercises/kindergarten-garden/stack.yaml +1 -1
- data/tracks/haskell/exercises/largest-series-product/stack.yaml +1 -1
- data/tracks/haskell/exercises/leap/package.yaml +1 -1
- data/tracks/haskell/exercises/leap/stack.yaml +1 -1
- data/tracks/haskell/exercises/leap/test/Tests.hs +1 -1
- data/tracks/haskell/exercises/lens-person/stack.yaml +1 -1
- data/tracks/haskell/exercises/linked-list/stack.yaml +1 -1
- data/tracks/haskell/exercises/list-ops/stack.yaml +1 -1
- data/tracks/haskell/exercises/luhn/stack.yaml +1 -1
- data/tracks/haskell/exercises/matrix/stack.yaml +1 -1
- data/tracks/haskell/exercises/meetup/stack.yaml +1 -1
- data/tracks/haskell/exercises/minesweeper/stack.yaml +1 -1
- data/tracks/haskell/exercises/nth-prime/package.yaml +1 -1
- data/tracks/haskell/exercises/nth-prime/stack.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/README.md +2 -2
- data/tracks/haskell/exercises/nucleotide-count/package.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/stack.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/test/Tests.hs +6 -0
- data/tracks/haskell/exercises/ocr-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/octal/stack.yaml +1 -1
- data/tracks/haskell/exercises/palindrome-products/README.md +1 -1
- data/tracks/haskell/exercises/palindrome-products/stack.yaml +1 -1
- data/tracks/haskell/exercises/pangram/package.yaml +1 -1
- data/tracks/haskell/exercises/pangram/stack.yaml +1 -1
- data/tracks/haskell/exercises/pangram/test/Tests.hs +6 -2
- data/tracks/haskell/exercises/parallel-letter-frequency/stack.yaml +1 -1
- data/tracks/haskell/exercises/pascals-triangle/stack.yaml +1 -1
- data/tracks/haskell/exercises/perfect-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/phone-number/README.md +1 -1
- data/tracks/haskell/exercises/phone-number/stack.yaml +1 -1
- data/tracks/haskell/exercises/pig-latin/stack.yaml +1 -1
- data/tracks/haskell/exercises/pov/stack.yaml +1 -1
- data/tracks/haskell/exercises/prime-factors/stack.yaml +1 -1
- data/tracks/haskell/exercises/pythagorean-triplet/stack.yaml +1 -1
- data/tracks/haskell/exercises/queen-attack/stack.yaml +1 -1
- data/tracks/haskell/exercises/raindrops/stack.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/stack.yaml +1 -1
- data/tracks/haskell/exercises/robot-name/stack.yaml +1 -1
- data/tracks/haskell/exercises/robot-simulator/stack.yaml +1 -1
- data/tracks/haskell/exercises/roman-numerals/stack.yaml +1 -1
- data/tracks/haskell/exercises/rotational-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/run-length-encoding/stack.yaml +1 -1
- data/tracks/haskell/exercises/saddle-points/stack.yaml +1 -1
- data/tracks/haskell/exercises/say/stack.yaml +1 -1
- data/tracks/haskell/exercises/scrabble-score/stack.yaml +1 -1
- data/tracks/haskell/exercises/secret-handshake/stack.yaml +1 -1
- data/tracks/haskell/exercises/series/stack.yaml +1 -1
- data/tracks/haskell/exercises/sgf-parsing/stack.yaml +1 -1
- data/tracks/haskell/exercises/sieve/stack.yaml +1 -1
- data/tracks/haskell/exercises/simple-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/simple-linked-list/stack.yaml +1 -1
- data/tracks/haskell/exercises/space-age/stack.yaml +1 -1
- data/tracks/haskell/exercises/spiral-matrix/stack.yaml +1 -1
- data/tracks/haskell/exercises/strain/stack.yaml +1 -1
- data/tracks/haskell/exercises/sublist/stack.yaml +1 -1
- data/tracks/haskell/exercises/sum-of-multiples/stack.yaml +1 -1
- data/tracks/haskell/exercises/triangle/stack.yaml +1 -1
- data/tracks/haskell/exercises/trinary/stack.yaml +1 -1
- data/tracks/haskell/exercises/word-count/stack.yaml +1 -1
- data/tracks/haskell/exercises/wordy/examples/success-standard/src/WordProblem.hs +6 -5
- data/tracks/haskell/exercises/wordy/stack.yaml +1 -1
- data/tracks/haskell/exercises/zebra-puzzle/package.yaml +1 -1
- data/tracks/haskell/exercises/zebra-puzzle/stack.yaml +1 -1
- data/tracks/haskell/exercises/zipper/README.md +1 -1
- data/tracks/haskell/exercises/zipper/stack.yaml +1 -1
- data/tracks/javascript/.eslintignore +43 -0
- data/tracks/javascript/.travis.yml +2 -1
- data/tracks/javascript/exercises/bowling/README.md +5 -5
- data/tracks/javascript/exercises/crypto-square/example.js +2 -1
- data/tracks/javascript/exercises/diffie-hellman/diffie-hellman.spec.js +20 -20
- data/tracks/javascript/exercises/diffie-hellman/example.js +10 -10
- data/tracks/javascript/exercises/largest-series-product/example.js +2 -1
- data/tracks/javascript/exercises/sieve/example.js +5 -2
- data/tracks/javascript/package-lock.json +129 -76
- data/tracks/javascript/package.json +6 -5
- data/tracks/ocaml/config.json +10 -0
- data/tracks/ocaml/exercises/hamming/test.ml +3 -3
- data/tracks/ocaml/exercises/leap/test.ml +2 -2
- data/tracks/ocaml/exercises/pangram/test.ml +3 -3
- data/tracks/ocaml/exercises/rectangles/.merlin +5 -0
- data/tracks/ocaml/exercises/rectangles/Makefile +11 -0
- data/tracks/ocaml/exercises/rectangles/example.ml +30 -0
- data/tracks/ocaml/exercises/rectangles/rectangles.mli +1 -0
- data/tracks/ocaml/exercises/rectangles/test.ml +72 -0
- data/tracks/ocaml/tools/test-generator/templates/ocaml/leap/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/rectangles/test.ml +15 -0
- data/tracks/pony/README.md +1 -1
- data/tracks/pony/exercises/atbash-cipher/example.pony +6 -10
- data/tracks/pony/exercises/difference-of-squares/example.pony +3 -7
- data/tracks/rust/_test/count-ignores.sh +2 -2
- data/tracks/rust/config.json +24 -0
- data/tracks/rust/config/maintainers.json +10 -0
- data/tracks/rust/exercises/acronym/README.md +0 -1
- data/tracks/rust/exercises/all-your-base/README.md +1 -1
- data/tracks/rust/exercises/allergies/README.md +0 -1
- data/tracks/rust/exercises/alphametics/README.md +2 -2
- data/tracks/rust/exercises/atbash-cipher/README.md +2 -1
- data/tracks/rust/exercises/beer-song/README.md +1 -1
- data/tracks/rust/exercises/bowling/README.md +20 -6
- data/tracks/rust/exercises/circular-buffer/README.md +13 -6
- data/tracks/rust/exercises/crypto-square/README.md +10 -8
- data/tracks/rust/exercises/dominoes/Cargo.toml +1 -1
- data/tracks/rust/exercises/etl/README.md +2 -0
- data/tracks/rust/exercises/grade-school/README.md +0 -1
- data/tracks/rust/exercises/grains/README.md +0 -1
- data/tracks/rust/exercises/isbn-verifier/Cargo.lock +4 -0
- data/tracks/rust/exercises/isbn-verifier/Cargo.toml +3 -0
- data/tracks/rust/exercises/isbn-verifier/README.md +74 -0
- data/tracks/rust/exercises/isbn-verifier/example.rs +44 -0
- data/tracks/rust/exercises/isbn-verifier/src/lib.rs +4 -0
- data/tracks/rust/exercises/isbn-verifier/tests/isbn-verifier.rs +83 -0
- data/tracks/rust/exercises/isogram/README.md +3 -2
- data/tracks/rust/exercises/leap/README.md +1 -1
- data/tracks/rust/exercises/luhn/README.md +7 -7
- data/tracks/rust/exercises/nucleotide-count/README.md +8 -22
- data/tracks/rust/exercises/ocr-numbers/README.md +5 -5
- data/tracks/rust/exercises/pangram/README.md +1 -1
- data/tracks/rust/exercises/pascals-triangle/README.md +1 -1
- data/tracks/rust/exercises/perfect-numbers/README.md +2 -2
- data/tracks/rust/exercises/phone-number/README.md +3 -2
- data/tracks/rust/exercises/protein-translation/README.md +4 -5
- data/tracks/rust/exercises/proverb/README.md +13 -11
- data/tracks/rust/exercises/proverb/example.rs +14 -15
- data/tracks/rust/exercises/proverb/tests/proverb.rs +40 -13
- data/tracks/rust/exercises/pythagorean-triplet/README.md +3 -3
- data/tracks/rust/exercises/queen-attack/README.md +1 -1
- data/tracks/rust/exercises/rectangles/README.md +7 -7
- data/tracks/rust/exercises/roman-numerals/README.md +1 -1
- data/tracks/rust/exercises/rotational-cipher/README.md +2 -1
- data/tracks/rust/exercises/run-length-encoding/README.md +4 -4
- data/tracks/rust/exercises/scrabble-score/README.md +3 -1
- data/tracks/rust/exercises/space-age/README.md +1 -1
- data/tracks/rust/exercises/tournament/README.md +5 -5
- data/tracks/rust/exercises/triangle/README.md +9 -6
- data/tracks/rust/exercises/two-bucket/Cargo.lock +4 -0
- data/tracks/rust/exercises/two-bucket/Cargo.toml +3 -0
- data/tracks/rust/exercises/two-bucket/README.md +69 -0
- data/tracks/rust/exercises/two-bucket/example.rs +129 -0
- data/tracks/rust/exercises/two-bucket/src/lib.rs +26 -0
- data/tracks/rust/exercises/two-bucket/tests/two-bucket.rs +68 -0
- data/tracks/rust/exercises/variable-length-quantity/README.md +6 -7
- data/tracks/rust/exercises/word-count/README.md +1 -2
- data/tracks/rust/exercises/wordy/README.md +0 -5
- metadata +33 -4
- data/tracks/go/.github/PULL_REQUEST_TEMPLATE.md +0 -23
- data/tracks/ruby/.github/PULL_REQUEST_TEMPLATE.md +0 -40
data/tracks/ocaml/config.json
CHANGED
@@ -299,6 +299,16 @@
|
|
299
299
|
"unlocked_by": null,
|
300
300
|
"uuid": "202e8a9a-7a5e-486f-883b-56be298ed665"
|
301
301
|
},
|
302
|
+
{
|
303
|
+
"core": false,
|
304
|
+
"difficulty": 6,
|
305
|
+
"slug": "rectangles",
|
306
|
+
"topics": [
|
307
|
+
"search"
|
308
|
+
],
|
309
|
+
"unlocked_by": null,
|
310
|
+
"uuid": "1b491d7e-40db-4782-a8bb-7cb3746588f5"
|
311
|
+
},
|
302
312
|
{
|
303
313
|
"core": false,
|
304
314
|
"difficulty": 6,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
(* Test/exercise version: "
|
1
|
+
(* Test/exercise version: "2.0.1" *)
|
2
2
|
|
3
3
|
open Core
|
4
4
|
open OUnit2
|
@@ -39,9 +39,9 @@ let tests = [
|
|
39
39
|
"small distance in long strands" >::
|
40
40
|
ae (Some 2) (hamdist "ACCAGGG" "ACTATGG");
|
41
41
|
"non-unique character in first strand" >::
|
42
|
-
ae (Some 1) (hamdist "
|
42
|
+
ae (Some 1) (hamdist "AAG" "AAA");
|
43
43
|
"non-unique character in second strand" >::
|
44
|
-
ae (Some 1) (hamdist "
|
44
|
+
ae (Some 1) (hamdist "AAA" "AAG");
|
45
45
|
"same nucleotides in different positions" >::
|
46
46
|
ae (Some 2) (hamdist "TAG" "GAT");
|
47
47
|
"large distance" >::
|
@@ -1,4 +1,4 @@
|
|
1
|
-
(* Test/exercise version: "1.
|
1
|
+
(* Test/exercise version: "1.2.0" *)
|
2
2
|
|
3
3
|
open Core
|
4
4
|
open OUnit2
|
@@ -10,7 +10,7 @@ let tests = [
|
|
10
10
|
"year not divisible by 4: common year" >::
|
11
11
|
ae false (leap_year 2015);
|
12
12
|
"year divisible by 4, not divisible by 100: leap year" >::
|
13
|
-
ae true (leap_year
|
13
|
+
ae true (leap_year 1996);
|
14
14
|
"year divisible by 100, not divisible by 400: common year" >::
|
15
15
|
ae false (leap_year 2100);
|
16
16
|
"year divisible by 400: leap year" >::
|
@@ -1,4 +1,4 @@
|
|
1
|
-
(* Test/exercise version: "1.
|
1
|
+
(* Test/exercise version: "1.3.0" *)
|
2
2
|
|
3
3
|
open Core
|
4
4
|
open OUnit2
|
@@ -15,8 +15,8 @@ let tests = [
|
|
15
15
|
ae true (is_pangram "the quick brown fox jumps over the lazy dog");
|
16
16
|
"missing character 'x'" >::
|
17
17
|
ae false (is_pangram "a quick movement of the enemy will jeopardize five gunboats");
|
18
|
-
"another missing character '
|
19
|
-
ae false (is_pangram "
|
18
|
+
"another missing character, e.g. 'h'" >::
|
19
|
+
ae false (is_pangram "five boxing wizards jump quickly at it");
|
20
20
|
"pangram with underscores" >::
|
21
21
|
ae true (is_pangram "the_quick_brown_fox_jumps_over_the_lazy_dog");
|
22
22
|
"pangram with numbers" >::
|
@@ -0,0 +1,30 @@
|
|
1
|
+
type position = Start | UpperSide | RightSide | LowerSide | LeftSide
|
2
|
+
|
3
|
+
let count_rectangles pic =
|
4
|
+
let maxY = Array.length pic in
|
5
|
+
let maxX = if maxY > 0 then String.length pic.(0) else 0 in
|
6
|
+
let rec go count x y xStart yStart pos =
|
7
|
+
let on_side_fn dx dy next_pos () =
|
8
|
+
go count (x+dx) (y+dy) xStart yStart next_pos in
|
9
|
+
let on_corner_fn dx1 dy1 dx2 dy2 next_pos () =
|
10
|
+
go count (x+dx1) (y+dy1) xStart yStart next_pos + go count (x+dx2) (y+dy2) xStart yStart pos in
|
11
|
+
let progress side_ch on_side on_corner =
|
12
|
+
try
|
13
|
+
match pic.(y).[x] with
|
14
|
+
| c when c = side_ch -> on_side ()
|
15
|
+
| '+' -> on_corner ()
|
16
|
+
| _ -> count
|
17
|
+
with Invalid_argument _ -> count in
|
18
|
+
match pos with
|
19
|
+
| Start ->
|
20
|
+
if y = maxY then count
|
21
|
+
else if x = maxX then go count 0 (y+1) 0 (y+1) Start
|
22
|
+
else (match pic.(y).[x] with
|
23
|
+
| '+' -> go count (x+1) y x y UpperSide + go count (x+1) y x y Start
|
24
|
+
| _ -> go count (x+1) y (x+1) y Start
|
25
|
+
)
|
26
|
+
| UpperSide -> progress '-' (on_side_fn 1 0 UpperSide) (on_corner_fn 0 1 1 0 RightSide)
|
27
|
+
| RightSide -> progress '|' (on_side_fn 0 1 RightSide) (on_corner_fn (-1) 0 0 1 LowerSide)
|
28
|
+
| LowerSide -> progress '-' (on_side_fn (-1) 0 LowerSide) (on_corner_fn 0 (-1) (-1) 0 LeftSide)
|
29
|
+
| LeftSide -> progress '|' (on_side_fn 0 (-1) LeftSide) (fun () -> if x = xStart && y = yStart then count+1 else go count x (y-1) xStart yStart LeftSide)
|
30
|
+
in go 0 0 0 0 0 Start
|
@@ -0,0 +1 @@
|
|
1
|
+
val count_rectangles : string array -> int
|
@@ -0,0 +1,72 @@
|
|
1
|
+
(* Test/exercise version: "1.0.0" *)
|
2
|
+
|
3
|
+
open Core
|
4
|
+
open OUnit2
|
5
|
+
open Rectangles
|
6
|
+
|
7
|
+
let ae exp got _test_ctxt = assert_equal exp got ~printer:Int.to_string
|
8
|
+
|
9
|
+
let tests = [
|
10
|
+
"no rows" >::
|
11
|
+
ae 0 (count_rectangles [||]);
|
12
|
+
"no columns" >::
|
13
|
+
ae 0 (count_rectangles [|""|]);
|
14
|
+
"no rectangles" >::
|
15
|
+
ae 0 (count_rectangles [|" "|]);
|
16
|
+
"one rectangle" >::
|
17
|
+
ae 1 (count_rectangles [|"+-+";
|
18
|
+
"| |";
|
19
|
+
"+-+"|]);
|
20
|
+
"two rectangles without shared parts" >::
|
21
|
+
ae 2 (count_rectangles [|" +-+";
|
22
|
+
" | |";
|
23
|
+
"+-+-+";
|
24
|
+
"| | ";
|
25
|
+
"+-+ "|]);
|
26
|
+
"five rectangles with shared parts" >::
|
27
|
+
ae 5 (count_rectangles [|" +-+";
|
28
|
+
" | |";
|
29
|
+
"+-+-+";
|
30
|
+
"| | |";
|
31
|
+
"+-+-+"|]);
|
32
|
+
"rectangle of height 1 is counted" >::
|
33
|
+
ae 1 (count_rectangles [|"+--+";
|
34
|
+
"+--+"|]);
|
35
|
+
"rectangle of width 1 is counted" >::
|
36
|
+
ae 1 (count_rectangles [|"++";
|
37
|
+
"||";
|
38
|
+
"++"|]);
|
39
|
+
"1x1 square is counted" >::
|
40
|
+
ae 1 (count_rectangles [|"++";
|
41
|
+
"++"|]);
|
42
|
+
"only complete rectangles are counted" >::
|
43
|
+
ae 1 (count_rectangles [|" +-+";
|
44
|
+
" |";
|
45
|
+
"+-+-+";
|
46
|
+
"| | -";
|
47
|
+
"+-+-+"|]);
|
48
|
+
"rectangles can be of different sizes" >::
|
49
|
+
ae 3 (count_rectangles [|"+------+----+";
|
50
|
+
"| | |";
|
51
|
+
"+---+--+ |";
|
52
|
+
"| | |";
|
53
|
+
"+---+-------+"|]);
|
54
|
+
"corner is required for a rectangle to be complete" >::
|
55
|
+
ae 2 (count_rectangles [|"+------+----+";
|
56
|
+
"| | |";
|
57
|
+
"+------+ |";
|
58
|
+
"| | |";
|
59
|
+
"+---+-------+"|]);
|
60
|
+
"large input with many rectangles" >::
|
61
|
+
ae 60 (count_rectangles [|"+---+--+----+";
|
62
|
+
"| +--+----+";
|
63
|
+
"+---+--+ |";
|
64
|
+
"| +--+----+";
|
65
|
+
"+---+--+--+-+";
|
66
|
+
"+---+--+--+-+";
|
67
|
+
"+------+ | |";
|
68
|
+
" +-+"|]);
|
69
|
+
]
|
70
|
+
|
71
|
+
let () =
|
72
|
+
run_test_tt_main ("rectangles tests" >::: tests)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
open Core
|
2
|
+
open OUnit2
|
3
|
+
open Rectangles
|
4
|
+
|
5
|
+
let ae exp got _test_ctxt = assert_equal exp got ~printer:Int.to_string
|
6
|
+
|
7
|
+
let tests = [
|
8
|
+
(* TEST
|
9
|
+
"$description" >::
|
10
|
+
ae $expected (count_rectangles $input);
|
11
|
+
END TEST *)
|
12
|
+
]
|
13
|
+
|
14
|
+
let () =
|
15
|
+
run_test_tt_main ("rectangles tests" >::: tests)
|
data/tracks/pony/README.md
CHANGED
@@ -23,16 +23,12 @@ primitive Atbash
|
|
23
23
|
groups
|
24
24
|
|
25
25
|
fun encode(input: String): String iso^ =>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
.values())
|
33
|
-
else
|
34
|
-
recover String end
|
35
|
-
end
|
26
|
+
String.join(
|
27
|
+
Iter[U8](input.lower().values())
|
28
|
+
.filter(this~_transposable())
|
29
|
+
.map[U8]({(c: U8): U8 => Atbash._transpose(c) })
|
30
|
+
.fold[Array[String ref]]([String(6)], this~_group())
|
31
|
+
.values())
|
36
32
|
|
37
33
|
fun decode(input: String): String iso^ =>
|
38
34
|
recover
|
@@ -7,13 +7,9 @@ primitive Squares
|
|
7
7
|
sum * sum
|
8
8
|
|
9
9
|
fun sum_of_squares(n: USize): USize =>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
.fold[USize]({(acc: USize, x: USize): USize => acc + x }, 0)?
|
14
|
-
else
|
15
|
-
0
|
16
|
-
end
|
10
|
+
Iter[USize](Range(0, n + 1))
|
11
|
+
.map[USize]({(x: USize): USize => x * x })
|
12
|
+
.fold[USize](0, {(acc: USize, x: USize): USize => acc + x })
|
17
13
|
|
18
14
|
fun difference(n: USize): USize =>
|
19
15
|
square_of_sums(n) - sum_of_squares(n)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
|
3
|
+
repo=$(cd "$(dirname "$0")/.." && pwd)
|
4
4
|
exitcode=0
|
5
5
|
|
6
|
-
for t in $
|
6
|
+
for t in $repo/exercises/*/tests/*.rs; do
|
7
7
|
tests=$(grep "^\s*\#\[test\]" $t | wc -l | tr -d '[:space:]')
|
8
8
|
ignores=$(grep "^\s*\#\[ignore\]" $t | wc -l | tr -d '[:space:]')
|
9
9
|
want_ignores=$(expr $tests - 1)
|
data/tracks/rust/config.json
CHANGED
@@ -189,6 +189,18 @@
|
|
189
189
|
"loop"
|
190
190
|
]
|
191
191
|
},
|
192
|
+
{
|
193
|
+
"uuid": "c986c240-46de-419c-8ed6-700eb68f8db6",
|
194
|
+
"slug": "isbn-verifier",
|
195
|
+
"core": false,
|
196
|
+
"unlocked_by": null,
|
197
|
+
"difficulty": 4,
|
198
|
+
"topics": [
|
199
|
+
"conversion between string and int",
|
200
|
+
"loop",
|
201
|
+
"mathematics"
|
202
|
+
]
|
203
|
+
},
|
192
204
|
{
|
193
205
|
"uuid": "20e7d347-b80a-4656-ac34-0825126939ff",
|
194
206
|
"slug": "perfect-numbers",
|
@@ -658,6 +670,18 @@
|
|
658
670
|
"external crates (optional)"
|
659
671
|
]
|
660
672
|
},
|
673
|
+
{
|
674
|
+
"uuid": "1850fb3f-9dad-449a-90b6-9d90038cf34d",
|
675
|
+
"slug": "two-bucket",
|
676
|
+
"core": false,
|
677
|
+
"unlocked_by": null,
|
678
|
+
"difficulty": 4,
|
679
|
+
"topics": [
|
680
|
+
"algorithm",
|
681
|
+
"loops",
|
682
|
+
"mathematics"
|
683
|
+
]
|
684
|
+
},
|
661
685
|
{
|
662
686
|
"uuid": "c21c379b-fb23-449b-809a-3c6ef1c31221",
|
663
687
|
"slug": "pig-latin",
|
@@ -44,6 +44,16 @@
|
|
44
44
|
"link_text": null,
|
45
45
|
"link_url": null,
|
46
46
|
"avatar_url": null
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"github_username": "coriolinus",
|
50
|
+
"show_on_website": false,
|
51
|
+
"alumnus": false,
|
52
|
+
"name": null,
|
53
|
+
"bio": null,
|
54
|
+
"link_text": null,
|
55
|
+
"link_url": null,
|
56
|
+
"avatar_url": null
|
47
57
|
}
|
48
58
|
]
|
49
59
|
}
|
@@ -7,7 +7,6 @@ Techies love their TLA (Three Letter Acronyms)!
|
|
7
7
|
Help generate some jargon by writing a program that converts a long name
|
8
8
|
like Portable Network Graphics to its acronym (PNG).
|
9
9
|
|
10
|
-
|
11
10
|
## Rust Installation
|
12
11
|
|
13
12
|
Refer to the [exercism help page][help-page] for Rust installation and learning
|
@@ -6,6 +6,7 @@ Implement general base conversion. Given a number in base **a**,
|
|
6
6
|
represented as a sequence of digits, convert it to base **b**.
|
7
7
|
|
8
8
|
## Note
|
9
|
+
|
9
10
|
- Try to implement the conversion yourself.
|
10
11
|
Do not use something else to perform the conversion for you.
|
11
12
|
|
@@ -28,7 +29,6 @@ The number 1120, *in base 3*, means:
|
|
28
29
|
|
29
30
|
I think you got the idea!
|
30
31
|
|
31
|
-
|
32
32
|
*Yes. Those three numbers above are exactly the same. Congratulations!*
|
33
33
|
|
34
34
|
## Rust Installation
|
@@ -29,7 +29,6 @@ allergens that score 256, 512, 1024, etc.). Your program should
|
|
29
29
|
ignore those components of the score. For example, if the allergy
|
30
30
|
score is 257, your program should only report the eggs (1) allergy.
|
31
31
|
|
32
|
-
|
33
32
|
## Rust Installation
|
34
33
|
|
35
34
|
Refer to the [exercism help page][help-page] for Rust installation and learning
|
@@ -7,7 +7,7 @@ letters in words are replaced with numbers.
|
|
7
7
|
|
8
8
|
For example `SEND + MORE = MONEY`:
|
9
9
|
|
10
|
-
```
|
10
|
+
```text
|
11
11
|
S E N D
|
12
12
|
M O R E +
|
13
13
|
-----------
|
@@ -16,7 +16,7 @@ M O N E Y
|
|
16
16
|
|
17
17
|
Replacing these with valid numbers gives:
|
18
18
|
|
19
|
-
```
|
19
|
+
```text
|
20
20
|
9 5 6 7
|
21
21
|
1 0 8 5 +
|
22
22
|
-----------
|
@@ -9,7 +9,7 @@ letter, the second with the second-last, and so on.
|
|
9
9
|
|
10
10
|
An Atbash cipher for the Latin alphabet would be as follows:
|
11
11
|
|
12
|
-
```
|
12
|
+
```text
|
13
13
|
Plain: abcdefghijklmnopqrstuvwxyz
|
14
14
|
Cipher: zyxwvutsrqponmlkjihgfedcba
|
15
15
|
```
|
@@ -23,6 +23,7 @@ being 5 letters, and punctuation is excluded. This is to make it harder to guess
|
|
23
23
|
things based on word boundaries.
|
24
24
|
|
25
25
|
## Examples
|
26
|
+
|
26
27
|
- Encoding `test` gives `gvhg`
|
27
28
|
- Decoding `gvhg` gives `test`
|
28
29
|
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
|
@@ -4,7 +4,7 @@ Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles
|
|
4
4
|
|
5
5
|
Note that not all verses are identical.
|
6
6
|
|
7
|
-
```
|
7
|
+
```text
|
8
8
|
99 bottles of beer on the wall, 99 bottles of beer.
|
9
9
|
Take one down and pass it around, 98 bottles of beer on the wall.
|
10
10
|
|
@@ -2,19 +2,29 @@
|
|
2
2
|
|
3
3
|
Score a bowling game.
|
4
4
|
|
5
|
-
Bowling is game where players roll a heavy ball to knock down pins
|
5
|
+
Bowling is a game where players roll a heavy ball to knock down pins
|
6
6
|
arranged in a triangle. Write code to keep track of the score
|
7
7
|
of a game of bowling.
|
8
8
|
|
9
9
|
## Scoring Bowling
|
10
10
|
|
11
|
-
The game consists of 10 frames. A frame is composed of one or two ball
|
11
|
+
The game consists of 10 frames. A frame is composed of one or two ball
|
12
|
+
throws with 10 pins standing at frame initialization. There are three
|
13
|
+
cases for the tabulation of a frame.
|
12
14
|
|
13
|
-
* An open frame is where a score of less than 10 is recorded for the
|
15
|
+
* An open frame is where a score of less than 10 is recorded for the
|
16
|
+
frame. In this case the score for the frame is the number of pins
|
17
|
+
knocked down.
|
14
18
|
|
15
|
-
* A spare is where all ten pins are knocked down
|
19
|
+
* A spare is where all ten pins are knocked down by the second
|
20
|
+
throw. The total value of a spare is 10 plus the number of pins
|
21
|
+
knocked down in their next throw.
|
16
22
|
|
17
|
-
* A strike is where all ten pins are knocked down
|
23
|
+
* A strike is where all ten pins are knocked down by the first
|
24
|
+
throw. The total value of a strike is 10 plus the number of pins
|
25
|
+
knocked down in the next two throws. If a strike is immediately
|
26
|
+
followed by a second strike, then the value of the first strike
|
27
|
+
cannot be determined until the ball is thrown one more time.
|
18
28
|
|
19
29
|
Here is a three frame example:
|
20
30
|
|
@@ -30,7 +40,11 @@ Frame 3 is (9 + 0) = 9
|
|
30
40
|
|
31
41
|
This means the current running total is 48.
|
32
42
|
|
33
|
-
The tenth frame in the game is a special case. If someone throws a
|
43
|
+
The tenth frame in the game is a special case. If someone throws a
|
44
|
+
strike or a spare then they get a fill ball. Fill balls exist to
|
45
|
+
calculate the total of the 10th frame. Scoring a strike or spare on
|
46
|
+
the fill ball does not give the player more fill balls. The total
|
47
|
+
value of the 10th frame is the total number of pins knocked down.
|
34
48
|
|
35
49
|
For a tenth frame of X1/ (strike and a spare), the total value is 20.
|
36
50
|
|