trackler 2.2.1.61 → 2.2.1.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/forth/canonical-data.json +1 -7
  4. data/problem-specifications/exercises/meetup/description.md +16 -12
  5. data/problem-specifications/exercises/sum-of-multiples/description.md +3 -3
  6. data/tracks/c/config.json +14 -1
  7. data/tracks/c/exercises/anagram/src/anagram.h +19 -4
  8. data/tracks/c/exercises/anagram/src/example.c +27 -40
  9. data/tracks/c/exercises/anagram/test/test_anagram.c +100 -152
  10. data/tracks/c/exercises/sublist/README.md +53 -0
  11. data/tracks/c/exercises/sublist/makefile +15 -0
  12. data/tracks/c/exercises/sublist/src/example.c +63 -0
  13. data/tracks/c/exercises/sublist/src/sublist.h +17 -0
  14. data/tracks/c/exercises/sublist/test/test_sublist.c +243 -0
  15. data/tracks/c/exercises/sublist/test/vendor/unity.c +1300 -0
  16. data/tracks/c/exercises/sublist/test/vendor/unity.h +274 -0
  17. data/tracks/c/exercises/sublist/test/vendor/unity_internals.h +701 -0
  18. data/tracks/ecmascript/config.json +56 -0
  19. data/tracks/ecmascript/exercises/rectangles/README.md +95 -0
  20. data/tracks/ecmascript/exercises/rectangles/example.js +38 -0
  21. data/tracks/ecmascript/exercises/rectangles/package.json +72 -0
  22. data/tracks/ecmascript/exercises/rectangles/rectangles.spec.js +147 -0
  23. data/tracks/ecmascript/exercises/rotational-cipher/README.md +66 -0
  24. data/tracks/ecmascript/exercises/rotational-cipher/example.js +16 -0
  25. data/tracks/ecmascript/exercises/rotational-cipher/package.json +72 -0
  26. data/tracks/ecmascript/exercises/rotational-cipher/rotational-cipher.spec.js +73 -0
  27. data/tracks/ecmascript/exercises/spiral-matrix/README.md +59 -0
  28. data/tracks/ecmascript/exercises/spiral-matrix/example.js +26 -0
  29. data/tracks/ecmascript/exercises/spiral-matrix/package.json +72 -0
  30. data/tracks/ecmascript/exercises/spiral-matrix/spiral-matrix.spec.js +55 -0
  31. data/tracks/ecmascript/exercises/transpose/README.md +94 -0
  32. data/tracks/ecmascript/exercises/transpose/example.js +12 -0
  33. data/tracks/ecmascript/exercises/transpose/package.json +71 -0
  34. data/tracks/ecmascript/exercises/transpose/transpose.spec.js +121 -0
  35. data/tracks/go/exercises/allergies/.meta/gen.go +88 -0
  36. data/tracks/go/exercises/allergies/allergies_test.go +19 -46
  37. data/tracks/go/exercises/allergies/cases_test.go +60 -0
  38. data/tracks/go/exercises/bob/bob.go +0 -2
  39. data/tracks/go/exercises/forth/cases_test.go +2 -7
  40. data/tracks/go/exercises/nucleotide-count/nucleotide_count.go +0 -2
  41. data/tracks/go/exercises/pangram/.meta/gen.go +54 -0
  42. data/tracks/go/exercises/pangram/cases_test.go +62 -0
  43. data/tracks/go/exercises/pangram/example.go +3 -5
  44. data/tracks/go/exercises/pangram/pangram_test.go +3 -24
  45. data/tracks/go/exercises/rna-transcription/rna_transcription.go +0 -2
  46. data/tracks/go/exercises/robot-name/bonus_example.go +0 -2
  47. data/tracks/java/exercises/acronym/.meta/src/reference/java/Acronym.java +3 -3
  48. data/tracks/lfe/config.json +4 -3
  49. data/tracks/perl6/docs/SNIPPET.txt +8 -3
  50. data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
  51. data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
  52. data/tracks/perl6/exercises/allergies/allergies.t +10 -2
  53. data/tracks/perl6/exercises/allergies/example.yaml +10 -2
  54. data/tracks/perl6/exercises/leap/Example.pm6 +1 -1
  55. data/tracks/perl6/exercises/leap/Leap.pm6 +1 -1
  56. data/tracks/perl6/exercises/leap/example.yaml +10 -2
  57. data/tracks/perl6/exercises/leap/leap.t +10 -2
  58. data/tracks/perl6/exercises/luhn/Example.pm6 +1 -1
  59. data/tracks/perl6/exercises/luhn/Luhn.pm6 +1 -1
  60. data/tracks/perl6/exercises/luhn/example.yaml +10 -2
  61. data/tracks/perl6/exercises/luhn/luhn.t +10 -2
  62. data/tracks/perl6/exercises/pangram/Example.pm6 +1 -1
  63. data/tracks/perl6/exercises/pangram/Pangram.pm6 +1 -1
  64. data/tracks/perl6/exercises/pangram/example.yaml +12 -6
  65. data/tracks/perl6/exercises/pangram/pangram.t +9 -3
  66. data/tracks/python/config.json +38 -0
  67. data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +81 -66
  68. data/tracks/python/exercises/connect/README.md +44 -0
  69. data/tracks/python/exercises/connect/connect.py +7 -0
  70. data/tracks/python/exercises/connect/connect_test.py +118 -0
  71. data/tracks/python/exercises/connect/example.py +61 -0
  72. data/tracks/python/exercises/go-counting/README.md +44 -0
  73. data/tracks/python/exercises/go-counting/example.py +62 -0
  74. data/tracks/python/exercises/go-counting/go_counting.py +38 -0
  75. data/tracks/python/exercises/go-counting/go_counting_test.py +92 -0
  76. data/tracks/python/exercises/parallel-letter-frequency/README.md +24 -0
  77. data/tracks/python/exercises/parallel-letter-frequency/example.py +56 -0
  78. data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency.py +2 -0
  79. data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency_test.py +61 -0
  80. data/tracks/python/exercises/strain/README.md +3 -1
  81. data/tracks/python/exercises/strain/strain.py +2 -2
  82. data/tracks/rust/.travis.yml +1 -0
  83. data/tracks/rust/README.md +2 -0
  84. data/tracks/rust/_test/check-exercises.sh +41 -54
  85. data/tracks/rust/_test/ensure-readmes-are-updated.sh +40 -0
  86. data/tracks/rust/bin/test-exercise +84 -0
  87. data/tracks/rust/exercises/alphametics/.meta/test-in-release-mode +2 -0
  88. data/tracks/rust/exercises/alphametics/src/lib.rs +1 -1
  89. data/tracks/rust/exercises/dominoes/README.md +3 -3
  90. data/tracks/rust/exercises/isbn-verifier/README.md +3 -2
  91. data/tracks/rust/exercises/nucleotide-count/README.md +2 -2
  92. data/tracks/rust/exercises/perfect-numbers/src/lib.rs +10 -0
  93. data/tracks/rust/exercises/phone-number/README.md +1 -1
  94. data/tracks/rust/exercises/pythagorean-triplet/src/lib.rs +3 -0
  95. data/tracks/rust/exercises/rectangles/README.md +9 -9
  96. data/tracks/rust/exercises/two-bucket/README.md +7 -7
  97. data/tracks/typescript/config.json +16 -0
  98. data/tracks/typescript/exercises/diamond/README.md +84 -0
  99. data/tracks/typescript/exercises/diamond/diamond.example.ts +51 -0
  100. data/tracks/typescript/exercises/diamond/diamond.test.ts +35 -0
  101. data/tracks/typescript/exercises/diamond/diamond.ts +0 -0
  102. data/tracks/typescript/exercises/diamond/package.json +36 -0
  103. data/tracks/typescript/exercises/diamond/tsconfig.json +22 -0
  104. data/tracks/typescript/exercises/diamond/tslint.json +127 -0
  105. data/tracks/typescript/exercises/diamond/yarn.lock +2624 -0
  106. metadata +53 -2
@@ -9,7 +9,9 @@ For example, given the collection of numbers:
9
9
 
10
10
  - 1, 2, 3, 4, 5
11
11
 
12
- And the predicate:
12
+ And the predicate:
13
+
14
+ Note: _a predicate P(x) will be true or false, depending on whether x belongs to a set._ [Wikipedia - Predicate](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)))
13
15
 
14
16
  - is the number even?
15
17
 
@@ -1,6 +1,6 @@
1
- def keep():
1
+ def keep(sequence, predicate):
2
2
  pass
3
3
 
4
4
 
5
- def discard():
5
+ def discard(sequence, predicate):
6
6
  pass
@@ -6,6 +6,7 @@ script:
6
6
  - "sh ./_test/ensure-stubs-compile.sh"
7
7
  - "sh ./_test/count-ignores.sh"
8
8
  - "./bin/fetch-configlet"
9
+ - "sh ./_test/ensure-readmes-are-updated.sh"
9
10
  - "./bin/configlet lint ."
10
11
  sudo: false
11
12
  rust:
@@ -92,6 +92,8 @@ Note that:
92
92
  - An exercise may contain `.meta/hints.md`. This is optional and will appear after the normal exercise
93
93
  instructions if present. Rust is different in many ways from other languages. This is a place where the differences required for Rust are explained. If it is a large change, you may want to call this out as a comment at the top of `src/lib.rs`, so the user recognises to read this section before starting.
94
94
 
95
+ - If the test suite is appreciably sped up by running in release mode, and there is reason to be confident that the example implementation does not contain any overflow errors, consider adding a file `.meta/test-in-release-mode`. This should contain brief comments explaining the situation.
96
+
95
97
  - `README.md` may be [regenerated](https://github.com/exercism/docs/blob/master/maintaining-a-track/regenerating-exercise-readmes.md) from Exercism data. The generator will use the `description.md` from the exercise directory in the [problem-specifications repository](https://github.com/exercism/problem-specifications/tree/master/exercises), then any hints in `.meta/hints.md`, then the [Rust-specific instructions](https://github.com/exercism/rust/blob/master/config/exercise-readme-insert.md). The `## Source` section comes from the `metadata.yml` in the same directory. Convention is that the description of the source remains text and the link is both name and hyperlink of the markdown link.
96
98
 
97
99
  - Be sure to add the exercise to an appropriate place in the `config.json` file. The position in the file determines the order exercises are sent. Generate a unique UUID for the exercise. Current difficuly levels in use are 1, 4, 7 and 10.
@@ -1,73 +1,60 @@
1
1
  #!/bin/bash
2
2
 
3
+ # test for existence and executability of the test-exercise script
4
+ # this depends on that
5
+ if [ ! -f "./bin/test-exercise" ]; then
6
+ echo "bin/test-exercise does not exist"
7
+ exit 1
8
+ fi
9
+ if [ ! -x "./bin/test-exercise" ]; then
10
+ echo "bin/test-exercise does not have its executable bit set"
11
+ exit 1
12
+ fi
13
+
3
14
  # In DENYWARNINGS mode, do not set -e so that we run all tests.
4
15
  # This allows us to see all warnings.
5
16
  if [ -z "$DENYWARNINGS" ]; then
6
17
  set -e
7
18
  fi
8
19
 
20
+ # can't benchmark with a stable compiler; to bench, use
21
+ # $ BENCHMARK=1 rustup run nightly _test/check-exercises.sh
9
22
  if [ -n "$BENCHMARK" ]; then
10
23
  files=exercises/*/benches
11
24
  else
12
25
  files=exercises/*/tests
13
26
  fi
14
27
 
15
- tmp=${TMPDIR:-/tmp/}
16
- mkdir "${tmp}exercises"
17
-
18
- exitcode=0
19
-
28
+ return_code=0
20
29
  # An exercise worth testing is defined here as any top level directory with
21
30
  # a 'tests' directory
22
31
  for exercise in $files; do
23
- # This assumes that exercises are only one directory deep
24
- # and that the primary module is named the same as the directory
25
- directory=$(dirname "${exercise}");
26
-
27
- workdir=$(mktemp -d "${tmp}${directory}.XXXXXXXXXX")
28
-
29
- cp -R -T $directory $workdir
30
-
31
- # Run in subshell to change workdir without affecting current workdir.
32
- (
33
- cd $workdir
34
-
35
- cp example.rs src/lib.rs
36
-
37
- # Overwrite empty Cargo.toml if an example specific file exists
38
- if [ -f Cargo-example.toml ]; then
39
- cp Cargo-example.toml Cargo.toml
40
- fi
41
-
42
- # Forcibly strip all "ignore" statements from the testing files
43
- for test in tests/*.rs; do
44
- sed -i '/\[ignore\]/d' $test
45
- done
46
-
47
- # Run benchmarks instead of tests when enabled.
48
- if [ -n "$BENCHMARK" ]; then
49
- cargo bench
50
- elif [ -n "$DENYWARNINGS" ]; then
51
- sed -i -e '1i #![deny(warnings)]' src/lib.rs
52
-
53
- # No-run mode so we see no test output.
54
- # Quiet mode so we see no compile output
55
- # (such as "Compiling"/"Downloading").
56
- # Compiler errors will still be shown though.
57
- # Both flags are necessary to keep things quiet.
58
- cargo test --quiet --no-run
59
- else
60
- # Run the test and get the status
61
- cargo test
62
- fi
63
- )
64
-
65
- status=$?
66
-
67
- if [ $status -ne 0 ]
68
- then
69
- exitcode=1
70
- fi
32
+ # This assumes that exercises are only one directory deep
33
+ # and that the primary module is named the same as the directory
34
+ directory=$(dirname "${exercise}")
35
+
36
+ release=""
37
+ if [ -z "$BENCHMARK" -a -f "$directory/.meta/test-in-release-mode" ]; then
38
+ release="--release"
39
+ fi
40
+
41
+ if [ -n "$DENYWARNINGS" ]; then
42
+ # No-run mode so we see no test output.
43
+ # Quiet mode so we see no compile output
44
+ # (such as "Compiling"/"Downloading").
45
+ # Compiler errors will still be shown though.
46
+ # Both flags are necessary to keep things quiet.
47
+ ./bin/test-exercise $directory --quiet --no-run
48
+ return_code=$(($return_code | $?))
49
+ else
50
+ # Run the test and get the status
51
+ # We use release mode here because, while it somewhat increases
52
+ # the compile time for all exercises, it substantially improves
53
+ # the runtime for certain exercises such as alphametics.
54
+ # Overall this should be an improvement.
55
+ ./bin/test-exercise $directory $release
56
+ return_code=$(($return_code | $?))
57
+ fi
71
58
  done
72
59
 
73
- exit $exitcode
60
+ exit $return_code
@@ -0,0 +1,40 @@
1
+ if [ ! -x bin/configlet ]; then
2
+ echo "Improper configuration; configlet should exist in bin/ when this script is run"
3
+ echo "Ping a Rust track maintainer to fix this"
4
+ exit 1
5
+ fi
6
+
7
+ if [ ! -d "problem-specifications" ]; then
8
+ git clone https://github.com/exercism/problem-specifications.git problem-specifications
9
+ fi
10
+
11
+ newline=$'\n '
12
+
13
+ missing_readmes=""
14
+ wrong_readmes=""
15
+ for exercise in $(git diff --name-only master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do
16
+ echo "Checking readme for $exercise"
17
+ readme_path="exercises/${exercise}/README.md"
18
+ if [ ! -f $readme_path ]; then
19
+ missing_readmes="$missing_readmes$newline$exercise"
20
+ else
21
+ existing_readme_checksum=$(md5sum $readme_path | cut -d' ' -f1)
22
+ # generate the new README
23
+ bin/configlet generate . --only "$exercise" --spec-path "problem-specifications"
24
+ generated_readme_checksum=$(md5sum $readme_path | cut -d' ' -f1)
25
+
26
+ if [ $existing_readme_checksum != $generated_readme_checksum ]; then
27
+ wrong_readmes="$wrong_readmes$newline$exercise"
28
+ fi
29
+ fi
30
+ done
31
+
32
+ if [ -n "$missing_readmes" ]; then
33
+ echo "Exercises missing README.md:$missing_readmes"
34
+ fi
35
+ if [ -n "$wrong_readmes" ]; then
36
+ echo "Exercises with out-of-date README.md:$wrong_readmes"
37
+ fi
38
+ if [ -n "$missing_readmes" -o -n "$wrong_readmes" ]; then
39
+ exit 1
40
+ fi
@@ -0,0 +1,84 @@
1
+ #!/bin/bash
2
+ # Test an exercise
3
+
4
+ # which exercise are we testing right now?
5
+ # if we were passed an argument, that should be the
6
+ # exercise directory. Otherwise, assume we're in
7
+ # it currently.
8
+ if [ $# -ge 1 ]; then
9
+ exercise=$1
10
+ # if this script is called with arguments, it will pass through
11
+ # any beyond the first to cargo. Note that we can only get a
12
+ # free default argument if no arguments at all were passed,
13
+ # so if you are in the exercise directory and want to pass any
14
+ # arguments to cargo, you need to include the local path first.
15
+ # I.e. to test in release mode:
16
+ # $ test-exercise . --release
17
+ shift 1
18
+ else
19
+ exercise='.'
20
+ fi
21
+
22
+ # what cargo command will we use?
23
+ if [ -n "$BENCHMARK" ]; then
24
+ command="bench"
25
+ else
26
+ command="test"
27
+ fi
28
+
29
+ declare -a preserve_files=("src/lib.rs" "Cargo.toml" "Cargo.lock")
30
+ declare -a preserve_dirs=("tests")
31
+
32
+ # reset instructions
33
+ reset () {
34
+ for file in ${preserve_files[@]}; do
35
+ if [ -f "$exercise/$file.orig" ]; then
36
+ mv -f "$exercise/$file.orig" "$exercise/$file"
37
+ fi
38
+ done
39
+ for dir in ${preserve_dirs[@]}; do
40
+ if [ -d "$exercise/$dir.orig" ]; then
41
+ rm -rf "$exercise/$dir"
42
+ mv "$exercise/$dir.orig" "$exercise/$dir"
43
+ fi
44
+ done
45
+ }
46
+
47
+ # cause the reset to execute when the script exits normally or is killed
48
+ trap reset EXIT INT TERM
49
+
50
+ # preserve the files and directories we care about
51
+ for file in ${preserve_files[@]}; do
52
+ if [ -f "$exercise/$file" ]; then
53
+ cp "$exercise/$file" "$exercise/$file.orig"
54
+ fi
55
+ done
56
+ for dir in ${preserve_dirs[@]}; do
57
+ if [ -d "$exercise/$dir" ]; then
58
+ cp -r "$exercise/$dir" "$exercise/$dir.orig"
59
+ fi
60
+ done
61
+
62
+ # Move example files to where Cargo expects them
63
+ cp -f "$exercise/example.rs" "$exercise/src/lib.rs"
64
+ if [ -f "$exercise/Cargo-example.toml" ]; then
65
+ cp -f "$exercise/Cargo-example.toml" "$exercise/Cargo.toml"
66
+ fi
67
+
68
+ # If deny warnings, insert a deny warnings compiler directive in the header
69
+ if [ -n "$DENYWARNINGS" ]; then
70
+ sed -i -e '1i #![deny(warnings)]' "$exercise/src/lib.rs"
71
+ fi
72
+
73
+ # eliminate #[ignore] lines from tests
74
+ for test in "$exercise/tests/*.rs"; do
75
+ sed -i '/\[ignore\]/d' $test
76
+ done
77
+
78
+ # run tests from within exercise directory
79
+ # (use subshell so we auto-reset to current pwd after)
80
+ (
81
+ cd $exercise
82
+ # this is the last command; its exit code is what's passed on
83
+ cargo $command "$@"
84
+ )
@@ -0,0 +1,2 @@
1
+ Takes a very long time to test in debug mode.
2
+ Example implementation not known to encounter overflow errors.
@@ -1,5 +1,5 @@
1
1
  use std::collections::HashMap;
2
2
 
3
- pub fn solve(puzzle: &str) -> Option<HashMap<char, u8>> {
3
+ pub fn solve(_: &str) -> Option<HashMap<char, u8>> {
4
4
  unimplemented!()
5
5
  }
@@ -7,10 +7,10 @@ correct domino chain (the dots on one half of a stone match the dots on the
7
7
  neighbouring half of an adjacent stone) and that dots on the halfs of the stones
8
8
  which don't have a neighbour (the first and last stone) match each other.
9
9
 
10
- For example given the stones `21`, `23` and `13` you should compute something
11
- like `12 23 31` or `32 21 13` or `13 32 21` etc, where the first and last numbers are the same.
10
+ For example given the stones `[2|1]`, `[2|3]` and `[1|3]` you should compute something
11
+ like `[1|2] [2|3] [3|1]` or `[3|2] [2|1] [1|3]` or `[1|3] [3|2] [2|1]` etc, where the first and last numbers are the same.
12
12
 
13
- For stones 12, 41 and 23 the resulting chain is not valid: 41 12 23's first and last numbers are not the same. 4 != 3
13
+ For stones `[1|2]`, `[4|1]` and `[2|3]` the resulting chain is not valid: `[4|1] [1|2] [2|3]`'s first and last numbers are not the same. 4 != 3
14
14
 
15
15
  Some test cases may use duplicate stones in a chain solution, assume that multiple Domino sets are being used.
16
16
 
@@ -54,7 +54,7 @@ to pass again. The test file is located in the `tests` directory. You can
54
54
  also remove the ignore flag from all the tests to get them to run all at once
55
55
  if you wish.
56
56
 
57
- Make sure to read the [Crates and Modules](https://doc.rust-lang.org/stable/book/crates-and-modules.html) chapter if you
57
+ Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
58
58
  haven't already, it will help you with organizing your files.
59
59
 
60
60
  ## Feedback, Issues, Pull Requests
@@ -64,7 +64,8 @@ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is th
64
64
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
65
65
 
66
66
  [help-page]: http://exercism.io/languages/rust
67
- [crates-and-modules]: http://doc.rust-lang.org/stable/book/crates-and-modules.html
67
+ [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
68
+ [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
68
69
 
69
70
  ## Source
70
71
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Given a single stranded DNA string, compute how many times each nucleotide occurs in the string.
4
4
 
5
- The genetic language of every living thing on the planet is DNA.
6
- DNA is a large molecule that is built from an extremely long sequence of individual elements called nucleotides.
5
+ The genetic language of every living thing on the planet is DNA.
6
+ DNA is a large molecule that is built from an extremely long sequence of individual elements called nucleotides.
7
7
  4 types exist in DNA and these differ only slightly and can be represented as the following symbols: 'A' for adenine, 'C' for cytosine, 'G' for guanine, and 'T' thymine.
8
8
 
9
9
  Here is an analogy:
@@ -0,0 +1,10 @@
1
+ #[derive(Debug, PartialEq, Eq)]
2
+ pub enum Classification {
3
+ Abundant,
4
+ Perfect,
5
+ Deficient
6
+ }
7
+
8
+ pub fn classify(num: u64) -> Result<Classification, & 'static str> {
9
+ unimplemented!();
10
+ }
@@ -14,7 +14,7 @@ The format is usually represented as
14
14
 
15
15
  where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
16
16
 
17
- Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present.
17
+ Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
18
18
 
19
19
  For example, the inputs
20
20
  - `+1 (613)-995-0253`
@@ -0,0 +1,3 @@
1
+ pub fn find() -> Option<u32> {
2
+ unimplemented!();
3
+ }
@@ -37,27 +37,27 @@ The above diagram contains 6 rectangles:
37
37
  ```
38
38
 
39
39
  ```text
40
-
41
-
40
+
41
+
42
42
  +--+
43
43
  | |
44
44
  +--+
45
45
  ```
46
46
 
47
47
  ```text
48
-
49
-
48
+
49
+
50
50
  +--+
51
51
  | |
52
52
  +--+
53
53
  ```
54
54
 
55
55
  ```text
56
-
57
- ++
58
- ++
59
-
60
-
56
+
57
+ ++
58
+ ++
59
+
60
+
61
61
  ```
62
62
 
63
63
  You may assume that the input is always a proper rectangle (i.e. the length of
@@ -7,15 +7,15 @@ Since this mathematical problem is fairly subject to interpretation / individual
7
7
  To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches!
8
8
 
9
9
  Your program will take as input:
10
- - the size of bucket one, passed as a numeric value
11
- - the size of bucket two, passed as a numeric value
12
- - the desired number of liters to reach, passed as a numeric value
13
- - which bucket to fill first, passed as a Bucket (either Bucket::One or Bucket::Two)
10
+ - the size of bucket one
11
+ - the size of bucket two
12
+ - the desired number of liters to reach
13
+ - which bucket to fill first, either bucket one or bucket two
14
14
 
15
15
  Your program should determine:
16
- - the total number of "moves" it should take to reach the desired number of liters, including the first fill - expects a numeric value
17
- - which bucket should end up with the desired number of liters (let's say this is bucket A) - expects a Bucket (either Bucket::One or Bucket::Two)
18
- - how many liters are left in the other bucket (bucket B) - expects a numeric value
16
+ - the total number of "moves" it should take to reach the desired number of liters, including the first fill
17
+ - which bucket should end up with the desired number of liters (let's say this is bucket A) - either bucket one or bucket two
18
+ - how many liters are left in the other bucket (bucket B)
19
19
 
20
20
  Note: any time a change is made to either or both buckets counts as one (1) move.
21
21
 
@@ -509,6 +509,22 @@
509
509
  ],
510
510
  "unlocked_by": "matrix",
511
511
  "uuid": "61f0964f-0779-446d-bd6b-6bb988414302"
512
+ },
513
+ {
514
+ "uuid": "2331a447-054d-4a80-52d7-fe2d667baaafcd3fc58",
515
+ "slug": "diamond",
516
+ "core": false,
517
+ "unlocked_by": "pascals-triangle",
518
+ "difficulty": 5,
519
+ "topics": [
520
+ "Control-flow (conditionals)",
521
+ "Control-flow (loops)",
522
+ "Arrays",
523
+ "Parsing",
524
+ "Games",
525
+ "Exception handling",
526
+ "Text formatting"
527
+ ]
512
528
  }
513
529
  ],
514
530
  "foregone": [],