trackler 2.2.1.59 → 2.2.1.60
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.
- 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
|
@@ -9,7 +9,7 @@ To begin with, convert a simple binary font to a string containing 0 or 1.
|
|
|
9
9
|
|
|
10
10
|
The binary font uses pipes and underscores, four rows high and three columns wide.
|
|
11
11
|
|
|
12
|
-
```
|
|
12
|
+
```text
|
|
13
13
|
_ #
|
|
14
14
|
| | # zero.
|
|
15
15
|
|_| #
|
|
@@ -18,7 +18,7 @@ The binary font uses pipes and underscores, four rows high and three columns wid
|
|
|
18
18
|
|
|
19
19
|
Is converted to "0"
|
|
20
20
|
|
|
21
|
-
```
|
|
21
|
+
```text
|
|
22
22
|
#
|
|
23
23
|
| # one.
|
|
24
24
|
| #
|
|
@@ -39,7 +39,7 @@ Update your program to recognize multi-character binary strings, replacing garbl
|
|
|
39
39
|
|
|
40
40
|
Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string.
|
|
41
41
|
|
|
42
|
-
```
|
|
42
|
+
```text
|
|
43
43
|
_
|
|
44
44
|
_|
|
|
45
45
|
|_
|
|
@@ -48,7 +48,7 @@ Update your program to recognize all numbers 0 through 9, both individually and
|
|
|
48
48
|
|
|
49
49
|
Is converted to "2"
|
|
50
50
|
|
|
51
|
-
```
|
|
51
|
+
```text
|
|
52
52
|
_ _ _ _ _ _ _ _ #
|
|
53
53
|
| _| _||_||_ |_ ||_||_|| | # decimal numbers.
|
|
54
54
|
||_ _| | _||_| ||_| _||_| #
|
|
@@ -61,7 +61,7 @@ Is converted to "1234567890"
|
|
|
61
61
|
|
|
62
62
|
Update your program to handle multiple numbers, one per line. When converting several lines, join the lines with commas.
|
|
63
63
|
|
|
64
|
-
```
|
|
64
|
+
```text
|
|
65
65
|
_ _
|
|
66
66
|
| _| _|
|
|
67
67
|
||_ _|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma,
|
|
4
4
|
"every letter") is a sentence using every letter of the alphabet at least once.
|
|
5
|
-
The best known English pangram is:
|
|
5
|
+
The best known English pangram is:
|
|
6
6
|
> The quick brown fox jumps over the lazy dog.
|
|
7
7
|
|
|
8
8
|
The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case
|
|
@@ -5,7 +5,7 @@ Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
|
|
|
5
5
|
|
|
6
6
|
The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for natural numbers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9
|
|
7
7
|
|
|
8
|
-
- **Perfect**: aliquot sum = number
|
|
8
|
+
- **Perfect**: aliquot sum = number
|
|
9
9
|
- 6 is a perfect number because (1 + 2 + 3) = 6
|
|
10
10
|
- 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28
|
|
11
11
|
- **Abundant**: aliquot sum > number
|
|
@@ -14,7 +14,7 @@ The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) d
|
|
|
14
14
|
- **Deficient**: aliquot sum < number
|
|
15
15
|
- 8 is a deficient number because (1 + 2 + 4) = 7
|
|
16
16
|
- Prime numbers are deficient
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
Implement a way to determine whether a given number is **perfect**. Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**.
|
|
19
19
|
|
|
20
20
|
## Rust Installation
|
|
@@ -6,11 +6,12 @@ The **North American Numbering Plan (NANP)** is a telephone numbering system use
|
|
|
6
6
|
|
|
7
7
|
NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*.
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
The format is usually represented as
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
12
|
(NXX)-NXX-XXXX
|
|
13
13
|
```
|
|
14
|
+
|
|
14
15
|
where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
|
|
15
16
|
|
|
16
17
|
Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present.
|
|
@@ -10,17 +10,17 @@ Codons: `"AUG", "UUU", "UCU"`
|
|
|
10
10
|
=> which become a polypeptide with the following sequence =>
|
|
11
11
|
|
|
12
12
|
Protein: `"Methionine", "Phenylalanine", "Serine"`
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
There are 64 codons which in turn correspond to 20 amino acids; however, all of the codon sequences and resulting amino acids are not important in this exercise. If it works for one codon, the program should work for all of them.
|
|
15
|
-
However, feel free to expand the list in the test suite to include them all.
|
|
15
|
+
However, feel free to expand the list in the test suite to include them all.
|
|
16
16
|
|
|
17
|
-
There are also
|
|
17
|
+
There are also three terminating codons (also known as 'STOP' codons); if any of these codons are encountered (by the ribosome), all translation ends and the protein is terminated.
|
|
18
18
|
|
|
19
19
|
All subsequent codons after are ignored, like this:
|
|
20
20
|
|
|
21
21
|
RNA: `"AUGUUUUCUUAAAUG"` =>
|
|
22
22
|
|
|
23
|
-
Codons: `"AUG", "UUU", "UCU", "UAG", "AUG"` =>
|
|
23
|
+
Codons: `"AUG", "UUU", "UCU", "UAG", "AUG"` =>
|
|
24
24
|
|
|
25
25
|
Protein: `"Methionine", "Phenylalanine", "Serine"`
|
|
26
26
|
|
|
@@ -39,7 +39,6 @@ UGU, UGC | Cysteine
|
|
|
39
39
|
UGG | Tryptophan
|
|
40
40
|
UAA, UAG, UGA | STOP
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
Learn more about [protein translation on Wikipedia](http://en.wikipedia.org/wiki/Translation_(biology))
|
|
44
43
|
|
|
45
44
|
## Rust Installation
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# Proverb
|
|
2
2
|
|
|
3
|
-
For want of a horseshoe nail, a kingdom was lost, or so the saying goes.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
For want of a horseshoe nail, a kingdom was lost, or so the saying goes.
|
|
4
|
+
|
|
5
|
+
Output the full text of this proverbial rhyme:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
For want of a nail the shoe was lost.
|
|
9
|
+
For want of a shoe the horse was lost.
|
|
10
|
+
For want of a horse the rider was lost.
|
|
11
|
+
For want of a rider the message was lost.
|
|
12
|
+
For want of a message the battle was lost.
|
|
13
|
+
For want of a battle the kingdom was lost.
|
|
14
|
+
And all for the want of a horseshoe nail.
|
|
15
|
+
```
|
|
14
16
|
## Rust Installation
|
|
15
17
|
|
|
16
18
|
Refer to the [exercism help page][help-page] for Rust installation and learning
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
pub fn build_proverb(items: Vec<&str>) -> String {
|
|
3
|
+
let mut stanzas = Vec::with_capacity(items.len());
|
|
4
|
+
for index in 0..items.len() {
|
|
5
|
+
if index == items.len() - 1 {
|
|
6
|
+
stanzas.push(format!("And all for the want of a {}.", items[0]));
|
|
7
|
+
} else {
|
|
8
|
+
stanzas.push(format!(
|
|
9
|
+
"For want of a {} the {} was lost.",
|
|
10
|
+
items[index],
|
|
11
|
+
items[index + 1]
|
|
12
|
+
));
|
|
13
|
+
}
|
|
4
14
|
}
|
|
5
|
-
|
|
6
|
-
for i in 1..list.len() {
|
|
7
|
-
out.push(format!("For want of a {} the {} was lost.", list[i-1], list[i]));
|
|
8
|
-
}
|
|
9
|
-
let end: String;
|
|
10
|
-
if list.len() > 2 {
|
|
11
|
-
end = format!("{}{} {}", list[2], list[1], list[0]);
|
|
12
|
-
} else {
|
|
13
|
-
end = format!("{}", list[0]);
|
|
14
|
-
}
|
|
15
|
-
out.push(format!("And all for the want of a {}.", end));
|
|
16
|
-
out.join("\n")
|
|
15
|
+
stanzas.join("\n")
|
|
17
16
|
}
|
|
@@ -5,8 +5,10 @@ use proverb::build_proverb;
|
|
|
5
5
|
#[test]
|
|
6
6
|
fn test_two_pieces() {
|
|
7
7
|
let input = vec!["nail", "shoe"];
|
|
8
|
-
let expected = vec![
|
|
9
|
-
|
|
8
|
+
let expected = vec![
|
|
9
|
+
"For want of a nail the shoe was lost.",
|
|
10
|
+
"And all for the want of a nail.",
|
|
11
|
+
].join("\n");
|
|
10
12
|
assert_eq!(build_proverb(input), expected);
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -15,9 +17,11 @@ fn test_two_pieces() {
|
|
|
15
17
|
#[ignore]
|
|
16
18
|
fn test_three_pieces() {
|
|
17
19
|
let input = vec!["nail", "shoe", "horse"];
|
|
18
|
-
let expected = vec![
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
let expected = vec![
|
|
21
|
+
"For want of a nail the shoe was lost.",
|
|
22
|
+
"For want of a shoe the horse was lost.",
|
|
23
|
+
"And all for the want of a nail.",
|
|
24
|
+
].join("\n");
|
|
21
25
|
assert_eq!(build_proverb(input), expected);
|
|
22
26
|
}
|
|
23
27
|
|
|
@@ -40,13 +44,36 @@ fn test_zero_pieces() {
|
|
|
40
44
|
#[test]
|
|
41
45
|
#[ignore]
|
|
42
46
|
fn test_full() {
|
|
43
|
-
let input = vec![
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
let input = vec![
|
|
48
|
+
"nail",
|
|
49
|
+
"shoe",
|
|
50
|
+
"horse",
|
|
51
|
+
"rider",
|
|
52
|
+
"message",
|
|
53
|
+
"battle",
|
|
54
|
+
"kingdom",
|
|
55
|
+
];
|
|
56
|
+
let expected = vec![
|
|
57
|
+
"For want of a nail the shoe was lost.",
|
|
58
|
+
"For want of a shoe the horse was lost.",
|
|
59
|
+
"For want of a horse the rider was lost.",
|
|
60
|
+
"For want of a rider the message was lost.",
|
|
61
|
+
"For want of a message the battle was lost.",
|
|
62
|
+
"For want of a battle the kingdom was lost.",
|
|
63
|
+
"And all for the want of a nail.",
|
|
64
|
+
].join("\n");
|
|
65
|
+
assert_eq!(build_proverb(input), expected);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#[test]
|
|
69
|
+
#[ignore]
|
|
70
|
+
fn test_three_pieces_modernized() {
|
|
71
|
+
let input = vec!["pin", "gun", "soldier", "battle"];
|
|
72
|
+
let expected = vec![
|
|
73
|
+
"For want of a pin the gun was lost.",
|
|
74
|
+
"For want of a gun the soldier was lost.",
|
|
75
|
+
"For want of a soldier the battle was lost.",
|
|
76
|
+
"And all for the want of a pin.",
|
|
77
|
+
].join("\n");
|
|
51
78
|
assert_eq!(build_proverb(input), expected);
|
|
52
79
|
}
|
|
@@ -11,7 +11,7 @@ A chessboard can be represented by an 8 by 8 array.
|
|
|
11
11
|
So if you're told the white queen is at (2, 3) and the black queen at
|
|
12
12
|
(5, 6), then you'd know you've got a set-up like so:
|
|
13
13
|
|
|
14
|
-
```
|
|
14
|
+
```text
|
|
15
15
|
_ _ _ _ _ _ _ _
|
|
16
16
|
_ _ _ _ _ _ _ _
|
|
17
17
|
_ _ _ W _ _ _ _
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Count the rectangles in an ASCII diagram like the one below.
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```text
|
|
6
6
|
+--+
|
|
7
7
|
++ |
|
|
8
8
|
+-++--+
|
|
@@ -12,7 +12,7 @@ Count the rectangles in an ASCII diagram like the one below.
|
|
|
12
12
|
|
|
13
13
|
The above diagram contains 6 rectangles:
|
|
14
14
|
|
|
15
|
-
```
|
|
15
|
+
```text
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
+-----+
|
|
@@ -20,7 +20,7 @@ The above diagram contains 6 rectangles:
|
|
|
20
20
|
+-----+
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
```
|
|
23
|
+
```text
|
|
24
24
|
+--+
|
|
25
25
|
| |
|
|
26
26
|
| |
|
|
@@ -28,7 +28,7 @@ The above diagram contains 6 rectangles:
|
|
|
28
28
|
+--+
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
```
|
|
31
|
+
```text
|
|
32
32
|
+--+
|
|
33
33
|
| |
|
|
34
34
|
+--+
|
|
@@ -36,7 +36,7 @@ The above diagram contains 6 rectangles:
|
|
|
36
36
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
```
|
|
39
|
+
```text
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
+--+
|
|
@@ -44,7 +44,7 @@ The above diagram contains 6 rectangles:
|
|
|
44
44
|
+--+
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
```
|
|
47
|
+
```text
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
+--+
|
|
@@ -52,7 +52,7 @@ The above diagram contains 6 rectangles:
|
|
|
52
52
|
+--+
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
```
|
|
55
|
+
```text
|
|
56
56
|
|
|
57
57
|
++
|
|
58
58
|
++
|
|
@@ -13,7 +13,7 @@ The most commonly used rotational cipher is `ROT13`.
|
|
|
13
13
|
|
|
14
14
|
A `ROT13` on the Latin alphabet would be as follows:
|
|
15
15
|
|
|
16
|
-
```
|
|
16
|
+
```text
|
|
17
17
|
Plain: abcdefghijklmnopqrstuvwxyz
|
|
18
18
|
Cipher: nopqrstuvwxyzabcdefghijklm
|
|
19
19
|
```
|
|
@@ -23,6 +23,7 @@ It is stronger than the Atbash cipher because it has 27 possible keys, and 25 us
|
|
|
23
23
|
Ciphertext is written out in the same formatting as the input including spaces and punctuation.
|
|
24
24
|
|
|
25
25
|
## Examples
|
|
26
|
+
|
|
26
27
|
- ROT5 `omg` gives `trl`
|
|
27
28
|
- ROT0 `c` gives `c`
|
|
28
29
|
- ROT26 `Cool` gives `Cool`
|
|
@@ -7,20 +7,20 @@ Run-length encoding (RLE) is a simple form of data compression, where runs
|
|
|
7
7
|
|
|
8
8
|
For example we can represent the original 53 characters with only 13.
|
|
9
9
|
|
|
10
|
-
```
|
|
10
|
+
```text
|
|
11
11
|
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB"
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
RLE allows the original data to be perfectly reconstructed from
|
|
15
15
|
the compressed data, which makes it a lossless data compression.
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```text
|
|
18
18
|
"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
For simplicity, you can assume that the unencoded string will only contain
|
|
22
|
-
the letters A through Z (either lower or upper case) and whitespace. This way
|
|
23
|
-
data to be encoded will never contain any numbers and numbers inside data to
|
|
22
|
+
the letters A through Z (either lower or upper case) and whitespace. This way
|
|
23
|
+
data to be encoded will never contain any numbers and numbers inside data to
|
|
24
24
|
be decoded always represent the count for the following character.
|
|
25
25
|
|
|
26
26
|
## Rust Installation
|
|
@@ -6,7 +6,7 @@ Given a word, compute the scrabble score for that word.
|
|
|
6
6
|
|
|
7
7
|
You'll need these:
|
|
8
8
|
|
|
9
|
-
```
|
|
9
|
+
```text
|
|
10
10
|
Letter Value
|
|
11
11
|
A, E, I, O, U, L, N, R, S, T 1
|
|
12
12
|
D, G 2
|
|
@@ -18,6 +18,7 @@ Q, Z 10
|
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Examples
|
|
21
|
+
|
|
21
22
|
"cabbage" should be scored as worth 14 points:
|
|
22
23
|
|
|
23
24
|
- 3 points for C
|
|
@@ -34,6 +35,7 @@ And to total:
|
|
|
34
35
|
- = 14
|
|
35
36
|
|
|
36
37
|
## Extensions
|
|
38
|
+
|
|
37
39
|
- You can play a double or a triple letter.
|
|
38
40
|
- You can play a double or a triple word.
|
|
39
41
|
|
|
@@ -12,7 +12,7 @@ Given an age in seconds, calculate how old someone would be on:
|
|
|
12
12
|
- Neptune: orbital period 164.79132 Earth years
|
|
13
13
|
|
|
14
14
|
So if you were told someone were 1,000,000,000 seconds old, you should
|
|
15
|
-
be able to say that they're 31 Earth-years old.
|
|
15
|
+
be able to say that they're 31.69 Earth-years old.
|
|
16
16
|
|
|
17
17
|
If you're wondering why Pluto didn't make the cut, go watch [this
|
|
18
18
|
youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
|
|
@@ -5,7 +5,7 @@ Tally the results of a small football competition.
|
|
|
5
5
|
Based on an input file containing which team played against which and what the
|
|
6
6
|
outcome was, create a file with a table like this:
|
|
7
7
|
|
|
8
|
-
```
|
|
8
|
+
```text
|
|
9
9
|
Team | MP | W | D | L | P
|
|
10
10
|
Devastating Donkeys | 3 | 2 | 1 | 0 | 7
|
|
11
11
|
Allegoric Alaskans | 3 | 2 | 0 | 1 | 6
|
|
@@ -31,7 +31,7 @@ Input
|
|
|
31
31
|
|
|
32
32
|
Your tallying program will receive input that looks like:
|
|
33
33
|
|
|
34
|
-
```
|
|
34
|
+
```text
|
|
35
35
|
Allegoric Alaskans;Blithering Badgers;win
|
|
36
36
|
Devastating Donkeys;Courageous Californians;draw
|
|
37
37
|
Devastating Donkeys;Allegoric Alaskans;win
|
|
@@ -42,7 +42,7 @@ Allegoric Alaskans;Courageous Californians;win
|
|
|
42
42
|
|
|
43
43
|
The result of the match refers to the first team listed. So this line
|
|
44
44
|
|
|
45
|
-
```
|
|
45
|
+
```text
|
|
46
46
|
Allegoric Alaskans;Blithering Badgers;win
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ Means that the Allegoric Alaskans beat the Blithering Badgers.
|
|
|
50
50
|
|
|
51
51
|
This line:
|
|
52
52
|
|
|
53
|
-
```
|
|
53
|
+
```text
|
|
54
54
|
Courageous Californians;Blithering Badgers;loss
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -58,7 +58,7 @@ Means that the Blithering Badgers beat the Courageous Californians.
|
|
|
58
58
|
|
|
59
59
|
And this line:
|
|
60
60
|
|
|
61
|
-
```
|
|
61
|
+
```text
|
|
62
62
|
Devastating Donkeys;Courageous Californians;draw
|
|
63
63
|
```
|
|
64
64
|
|