trackler 2.1.0.24 → 2.1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CONTRIBUTING.md +5 -8
- data/README.md +7 -7
- data/common/CONTRIBUTING.md +0 -5
- data/common/exercises/accumulate/description.md +4 -1
- data/common/exercises/acronym/description.md +1 -1
- data/common/exercises/bank-account/description.md +2 -1
- data/common/exercises/book-store/description.md +2 -5
- data/common/exercises/bracket-push/description.md +2 -4
- data/common/exercises/change/description.md +2 -5
- data/common/exercises/circular-buffer/description.md +0 -2
- data/common/exercises/clock/description.md +0 -2
- data/common/exercises/collatz-conjecture/canonical-data.json +36 -0
- data/common/exercises/collatz-conjecture/description.md +25 -0
- data/common/exercises/collatz-conjecture/metadata.yml +4 -0
- data/common/exercises/counter/description.md +1 -2
- data/common/exercises/diamond/description.md +0 -4
- data/common/exercises/flatten-array/description.md +1 -1
- data/common/exercises/grade-school/description.md +2 -1
- data/common/exercises/grains/description.md +2 -1
- data/common/exercises/grep/description.md +3 -2
- data/common/exercises/kindergarten-garden/description.md +2 -1
- data/common/exercises/largest-series-product/description.md +2 -1
- data/common/exercises/matrix/description.md +2 -1
- data/common/exercises/nucleotide-codons/description.md +2 -1
- data/common/exercises/ocr-numbers/description.md +2 -1
- data/common/exercises/octal/description.md +3 -1
- data/common/exercises/pangram/description.md +2 -1
- data/common/exercises/perfect-numbers/description.md +2 -1
- data/common/exercises/poker/description.md +0 -2
- data/common/exercises/protein-translation/description.md +3 -2
- data/common/exercises/proverb/description.md +2 -1
- data/common/exercises/pythagorean-triplet/description.md +4 -2
- data/common/exercises/queen-attack/description.md +2 -1
- data/common/exercises/rectangles/description.md +1 -3
- data/common/exercises/rotational-cipher/description.md +0 -4
- data/common/exercises/scale-generator/description.md +0 -2
- data/common/exercises/secret-handshake/description.md +2 -2
- data/common/exercises/series/description.md +2 -1
- data/common/exercises/sieve/description.md +2 -1
- data/common/exercises/space-age/description.md +0 -2
- data/common/exercises/strain/description.md +4 -5
- data/common/exercises/sublist/description.md +3 -6
- data/common/exercises/sum-of-multiples/description.md +2 -1
- data/common/exercises/tournament/description.md +4 -3
- data/common/exercises/transpose/description.md +1 -3
- data/common/exercises/trinary/description.md +2 -1
- data/common/exercises/two-bucket/description.md +1 -3
- data/common/exercises/two-fer/canonical-data.json +24 -0
- data/common/exercises/two-fer/description.md +40 -0
- data/common/exercises/two-fer/metadata.yml +4 -0
- data/common/exercises/word-search/description.md +2 -4
- data/common/exercises/zebra-puzzle/description.md +1 -1
- data/lib/trackler.rb +10 -5
- data/lib/trackler/description.rb +2 -2
- data/lib/trackler/guaranteed_file.rb +15 -15
- data/lib/trackler/implementation.rb +5 -5
- data/lib/trackler/implementations.rb +2 -2
- data/lib/trackler/metadata.rb +2 -2
- data/lib/trackler/problem.rb +2 -96
- data/lib/trackler/problems.rb +3 -48
- data/lib/trackler/specification.rb +101 -0
- data/lib/trackler/specifications.rb +52 -0
- data/lib/trackler/track.rb +6 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/LICENSE +21 -0
- data/tracks/bash/README.md +0 -5
- data/tracks/c/LICENSE +21 -0
- data/tracks/c/README.md +0 -5
- data/tracks/clojure/LICENSE +2 -2
- data/tracks/clojure/README.org +0 -5
- data/tracks/clojure/config.json +5 -0
- data/tracks/clojure/exercises/sublist/project.clj +4 -0
- data/tracks/clojure/exercises/sublist/src/example.clj +19 -0
- data/tracks/clojure/exercises/sublist/sublist.mustache +9 -0
- data/tracks/clojure/exercises/sublist/test/sublist_test.clj +40 -0
- data/tracks/cpp/LICENSE +2 -2
- data/tracks/cpp/README.md +0 -5
- data/tracks/csharp/LICENSE +2 -2
- data/tracks/csharp/README.md +0 -5
- data/tracks/delphi/LICENSE +2 -2
- data/tracks/delphi/README.md +0 -5
- data/tracks/ecmascript/LICENSE +2 -2
- data/tracks/ecmascript/README.md +0 -5
- data/tracks/elisp/.travis.yml +7 -3
- data/tracks/elisp/LICENSE +2 -2
- data/tracks/elisp/README.org +3 -6
- data/tracks/elisp/bin/test-examples +27 -0
- data/tracks/elisp/config.json +10 -0
- data/tracks/elisp/docs/LEARNING.org +0 -3
- data/tracks/elisp/exercises/grains/example.el +18 -0
- data/tracks/elisp/exercises/grains/grains-test.el +38 -0
- data/tracks/elisp/exercises/grains/grains.el +10 -0
- data/tracks/elisp/exercises/phone-number/example.el +34 -0
- data/tracks/elisp/exercises/phone-number/phone-number-test.el +43 -0
- data/tracks/elisp/exercises/phone-number/phone-number.el +9 -0
- data/tracks/elixir/LICENSE +2 -2
- data/tracks/elixir/README.md +0 -5
- data/tracks/elm/LICENSE +2 -2
- data/tracks/elm/README.md +0 -5
- data/tracks/erlang/LICENSE +2 -2
- data/tracks/erlang/README.md +0 -5
- data/tracks/erlang/SETUP.md +7 -0
- data/tracks/erlang/exercises/rotational-cipher/rebar.config +5 -5
- data/tracks/erlang/exercises/rotational-cipher/test/rotational_cipher_tests.erl +18 -18
- data/tracks/factor/LICENSE +2 -2
- data/tracks/fortran/.github/PULL_REQUEST_TEMPLATE.md +23 -0
- data/tracks/fortran/.gitignore +4 -0
- data/tracks/fortran/.travis.yml +17 -0
- data/tracks/fortran/LICENSE +21 -0
- data/tracks/fortran/Makefile +40 -0
- data/tracks/fortran/README.md +72 -0
- data/tracks/fortran/bin/fetch-configlet +32 -0
- data/tracks/fortran/config.json +32 -0
- data/tracks/{kotlin/SETUP.md → fortran/docs/ABOUT.md} +0 -0
- data/tracks/fortran/docs/INSTALLATION.md +0 -0
- data/tracks/fortran/docs/LEARNING.md +0 -0
- data/tracks/fortran/docs/RESOURCES.md +0 -0
- data/tracks/fortran/docs/TESTS.md +0 -0
- data/tracks/fortran/exercises/TRACK_HINTS.md +0 -0
- data/tracks/fortran/exercises/bob/bob.fun +114 -0
- data/tracks/fortran/exercises/bob/example.f90 +61 -0
- data/tracks/fortran/exercises/hello_world/example.f90 +9 -0
- data/tracks/fortran/exercises/hello_world/hello_world.fun +10 -0
- data/tracks/fortran/img/.keep +0 -0
- data/tracks/fsharp/LICENSE +2 -2
- data/tracks/fsharp/README.md +0 -5
- data/tracks/go/LICENSE +2 -2
- data/tracks/go/README.md +0 -5
- data/tracks/haskell/LICENSE +2 -2
- data/tracks/haskell/README.md +0 -5
- data/tracks/idris/LICENSE +2 -2
- data/tracks/idris/README.md +0 -5
- data/tracks/java/LICENSE +2 -2
- data/tracks/java/README.md +0 -7
- data/tracks/java/{SETUP.md → TRACK_HINTS.md} +0 -0
- data/tracks/java/config.json +5 -0
- data/tracks/java/exercises/_template/build.gradle +1 -0
- data/tracks/java/exercises/accumulate/build.gradle +1 -0
- data/tracks/java/exercises/acronym/build.gradle +1 -0
- data/tracks/java/exercises/all-your-base/build.gradle +1 -0
- data/tracks/java/exercises/allergies/build.gradle +1 -0
- data/tracks/java/exercises/anagram/build.gradle +1 -0
- data/tracks/java/exercises/atbash-cipher/build.gradle +1 -0
- data/tracks/java/exercises/beer-song/build.gradle +1 -0
- data/tracks/java/exercises/binary-search/build.gradle +1 -0
- data/tracks/java/exercises/binary/build.gradle +1 -0
- data/tracks/java/exercises/bob/build.gradle +1 -0
- data/tracks/java/exercises/book-store/build.gradle +1 -0
- data/tracks/java/exercises/bracket-push/build.gradle +1 -0
- data/tracks/java/exercises/change/build.gradle +1 -0
- data/tracks/java/exercises/clock/build.gradle +2 -1
- data/tracks/java/exercises/collatz-conjecture/build.gradle +18 -0
- data/tracks/java/exercises/collatz-conjecture/src/example/java/CollatzCalculator.java +19 -0
- data/tracks/java/exercises/collatz-conjecture/src/main/java/CollatzCalculator.java +7 -0
- data/tracks/java/exercises/collatz-conjecture/src/test/java/CollatzCalculatorTest.java +59 -0
- data/tracks/java/exercises/crypto-square/build.gradle +1 -0
- data/tracks/java/exercises/diamond/build.gradle +1 -0
- data/tracks/java/exercises/diamond/src/example/java/DiamondPrinter.java +4 -4
- data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +6 -2
- data/tracks/java/exercises/difference-of-squares/build.gradle +1 -0
- data/tracks/java/exercises/difference-of-squares/src/main/java/.keep +0 -0
- data/tracks/java/exercises/etl/build.gradle +1 -0
- data/tracks/java/exercises/flatten-array/build.gradle +1 -0
- data/tracks/java/exercises/gigasecond/build.gradle +1 -0
- data/tracks/java/exercises/grade-school/build.gradle +1 -0
- data/tracks/java/exercises/hamming/build.gradle +1 -0
- data/tracks/java/exercises/hexadecimal/build.gradle +1 -0
- data/tracks/java/exercises/isogram/build.gradle +1 -0
- data/tracks/java/exercises/kindergarten-garden/build.gradle +1 -0
- data/tracks/java/exercises/largest-series-product/build.gradle +1 -0
- data/tracks/java/exercises/linked-list/build.gradle +1 -0
- data/tracks/java/exercises/luhn/build.gradle +1 -0
- data/tracks/java/exercises/matrix/build.gradle +2 -1
- data/tracks/java/exercises/meetup/build.gradle +1 -0
- data/tracks/java/exercises/minesweeper/build.gradle +1 -0
- data/tracks/java/exercises/nth-prime/build.gradle +1 -0
- data/tracks/java/exercises/ocr-numbers/build.gradle +1 -0
- data/tracks/java/exercises/octal/build.gradle +1 -0
- data/tracks/java/exercises/pangram/build.gradle +1 -0
- data/tracks/java/exercises/pascals-triangle/build.gradle +1 -0
- data/tracks/java/exercises/perfect-numbers/build.gradle +1 -0
- data/tracks/java/exercises/phone-number/build.gradle +1 -0
- data/tracks/java/exercises/pig-latin/build.gradle +1 -0
- data/tracks/java/exercises/queen-attack/build.gradle +1 -0
- data/tracks/java/exercises/raindrops/build.gradle +1 -0
- data/tracks/java/exercises/rectangles/build.gradle +1 -0
- data/tracks/java/exercises/rna-transcription/build.gradle +1 -0
- data/tracks/java/exercises/robot-simulator/build.gradle +1 -0
- data/tracks/java/exercises/roman-numerals/build.gradle +1 -0
- data/tracks/java/exercises/run-length-encoding/build.gradle +1 -0
- data/tracks/java/exercises/saddle-points/build.gradle +1 -0
- data/tracks/java/exercises/scrabble-score/build.gradle +1 -0
- data/tracks/java/exercises/secret-handshake/build.gradle +1 -0
- data/tracks/java/exercises/series/build.gradle +1 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/java/exercises/sieve/build.gradle +1 -0
- data/tracks/java/exercises/simple-cipher/build.gradle +1 -0
- data/tracks/java/exercises/simple-linked-list/build.gradle +1 -0
- data/tracks/java/exercises/space-age/build.gradle +1 -0
- data/tracks/java/exercises/strain/build.gradle +1 -0
- data/tracks/java/exercises/sublist/build.gradle +1 -0
- data/tracks/java/exercises/sum-of-multiples/build.gradle +1 -0
- data/tracks/java/exercises/triangle/build.gradle +1 -0
- data/tracks/java/exercises/trinary/build.gradle +1 -0
- data/tracks/java/exercises/twelve-days/build.gradle +2 -1
- data/tracks/java/exercises/word-count/build.gradle +1 -0
- data/tracks/java/exercises/wordy/build.gradle +1 -0
- data/tracks/javascript/LICENSE +2 -2
- data/tracks/javascript/README.md +0 -5
- data/tracks/julia/LICENSE +2 -2
- data/tracks/kotlin/LICENSE +2 -2
- data/tracks/kotlin/README.md +0 -7
- data/tracks/kotlin/TRACK_HINTS.md +1 -0
- data/tracks/kotlin/exercises/phone-number/src/example/kotlin/PhoneNumber.kt +1 -1
- data/tracks/kotlin/exercises/phone-number/src/test/kotlin/PhoneNumberTest.kt +7 -8
- data/tracks/kotlin/exercises/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt +6 -6
- data/tracks/lfe/LICENSE +2 -2
- data/tracks/lfe/README.md +0 -5
- data/tracks/lisp/LICENSE +2 -2
- data/tracks/lisp/README.md +0 -5
- data/tracks/lua/LICENSE +2 -2
- data/tracks/lua/README.md +0 -5
- data/tracks/mips/LICENSE +2 -2
- data/tracks/mips/README.md +0 -5
- data/tracks/objective-c/LICENSE +2 -2
- data/tracks/objective-c/README.md +0 -5
- data/tracks/ocaml/LICENSE +2 -2
- data/tracks/ocaml/README.md +0 -5
- data/tracks/ocaml/config.json +54 -25
- data/tracks/ocaml/exercises/forth/.merlin +5 -0
- data/tracks/ocaml/exercises/forth/Makefile +11 -0
- data/tracks/ocaml/exercises/forth/example.ml +89 -0
- data/tracks/ocaml/exercises/forth/forth.mli +1 -0
- data/tracks/ocaml/exercises/forth/test.ml +147 -0
- data/tracks/ocaml/exercises/react/.merlin +5 -0
- data/tracks/ocaml/exercises/react/HINT.md +3 -0
- data/tracks/ocaml/exercises/react/Makefile +11 -0
- data/tracks/ocaml/exercises/react/example.ml +106 -0
- data/tracks/ocaml/exercises/react/react.mli +26 -0
- data/tracks/ocaml/exercises/react/test.ml +157 -0
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +5 -2
- data/tracks/ocaml/tools/test-generator/templates/forth/template.ml +114 -0
- data/tracks/perl5/LICENSE +2 -2
- data/tracks/perl6/LICENSE +2 -2
- data/tracks/perl6/README.md +0 -5
- data/tracks/perl6/config.json +5 -0
- data/tracks/perl6/exercises/clock/Example.pm6 +2 -2
- data/tracks/perl6/exercises/flatten-array/Example.pm6 +13 -0
- data/tracks/perl6/exercises/flatten-array/FlattenArray.pm6 +4 -0
- data/tracks/perl6/exercises/flatten-array/example.yaml +6 -0
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +80 -0
- data/tracks/php/LICENSE +2 -2
- data/tracks/php/README.md +0 -5
- data/tracks/powershell/.travis.yml +1 -0
- data/tracks/python/LICENSE +2 -2
- data/tracks/python/README.md +0 -5
- data/tracks/python/config.json +8 -0
- data/tracks/python/exercises/protein-translation/example.py +25 -0
- data/tracks/python/exercises/protein-translation/protein_translation.py +6 -0
- data/tracks/python/exercises/protein-translation/protein_translation_test.py +59 -0
- data/tracks/r/LICENSE +2 -2
- data/tracks/r/README.md +0 -5
- data/tracks/racket/LICENSE +2 -2
- data/tracks/racket/README.md +0 -5
- data/tracks/racket/config.json +5 -0
- data/tracks/racket/exercises/acronym/acronym-test.rkt +40 -0
- data/tracks/racket/exercises/acronym/acronym.rkt +3 -0
- data/tracks/racket/exercises/acronym/example.rkt +25 -0
- data/tracks/racket/exercises/grep/example.rkt +60 -26
- data/tracks/racket/exercises/grep/grep-test.rkt +154 -17
- data/tracks/racket/exercises/grep/grep.rkt +1 -18
- data/tracks/racket/exercises/grep/iliad.txt +9 -0
- data/tracks/racket/exercises/grep/midsummer-night.txt +7 -0
- data/tracks/racket/exercises/grep/paradise-lost.txt +8 -0
- data/tracks/ruby/README.md +4 -1
- data/tracks/ruby/exercises/acronym/.meta/.version +1 -1
- data/tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb +1 -1
- data/tracks/ruby/exercises/acronym/acronym_test.rb +2 -7
- data/tracks/ruby/exercises/anagram/.meta/generator/anagram_case.rb +1 -1
- data/tracks/ruby/exercises/beer-song/.meta/generator/beer_song_case.rb +1 -1
- data/tracks/ruby/exercises/clock/.meta/generator/clock_case.rb +1 -1
- data/tracks/ruby/exercises/connect/.meta/generator/connect_case.rb +0 -3
- data/tracks/ruby/exercises/connect/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/difference-of-squares/.meta/.version +1 -1
- data/tracks/ruby/exercises/difference-of-squares/.meta/solutions/difference_of_squares.rb +1 -1
- data/tracks/ruby/exercises/difference-of-squares/difference_of_squares_test.rb +12 -17
- data/tracks/ruby/exercises/triangle/.meta/generator/triangle_case.rb +10 -2
- data/tracks/ruby/exercises/triangle/triangle_test.rb +17 -17
- data/tracks/ruby/exercises/wordy/.meta/generator/wordy_case.rb +1 -1
- data/tracks/ruby/lib/generator/case_values.rb +1 -1
- data/tracks/ruby/lib/generator/exercise_case.rb +16 -2
- data/tracks/ruby/lib/generator/exercise_case/assertion.rb +4 -4
- data/tracks/ruby/test/fixtures/xruby/exercises/alpha/.meta/generator/alpha_case.rb +1 -1
- data/tracks/ruby/test/generator/case_values_test.rb +28 -7
- data/tracks/ruby/test/generator/exercise_case/assertion_test.rb +7 -7
- data/tracks/ruby/test/generator/exercise_case_test.rb +21 -25
- data/tracks/ruby/test/wordy_cases_test.rb +4 -4
- data/tracks/rust/LICENSE +2 -2
- data/tracks/rust/README.md +0 -5
- data/tracks/rust/config.json +1 -0
- data/tracks/rust/exercises/etl/Cargo.toml +1 -1
- data/tracks/rust/exercises/etl/example.rs +2 -2
- data/tracks/rust/exercises/etl/tests/etl.rs +26 -32
- data/tracks/rust/exercises/forth/tests/forth.rs +20 -22
- data/tracks/rust/exercises/minesweeper/Cargo.toml +1 -1
- data/tracks/rust/exercises/minesweeper/example.rs +3 -0
- data/tracks/rust/exercises/minesweeper/tests/minesweeper.rs +44 -46
- data/tracks/rust/exercises/raindrops/Cargo.toml +1 -1
- data/tracks/rust/exercises/raindrops/tests/raindrops.rs +12 -0
- data/tracks/rust/exercises/rna-transcription/Cargo.toml +1 -1
- data/tracks/rust/exercises/rna-transcription/example.rs +13 -9
- data/tracks/rust/exercises/rna-transcription/tests/rna-transcription.rs +23 -5
- data/tracks/scala/LICENSE +2 -2
- data/tracks/scala/README.md +0 -5
- data/tracks/scheme/LICENSE +2 -2
- data/tracks/scheme/README.org +0 -6
- data/tracks/swift/Dangerfile +1 -1
- data/tracks/swift/LICENSE +2 -2
- data/tracks/swift/README.md +0 -6
- data/tracks/vbnet/.travis.yml +1 -0
- data/tracks/vimscript/.travis.yml +4 -0
- data/tracks/vimscript/.vintrc.yaml +5 -0
- data/tracks/vimscript/TRACK_HINTS.md +19 -1
- data/tracks/vimscript/bin/pre-push +18 -0
- data/tracks/vimscript/config.json +8 -1
- data/tracks/vimscript/docs/ABOUT.md +7 -6
- data/tracks/vimscript/docs/TESTS.md +4 -4
- data/tracks/vimscript/exercises/allergies/allergies.vader +68 -0
- data/tracks/vimscript/exercises/allergies/allergies.vim +29 -0
- data/tracks/vimscript/exercises/allergies/example.vim +23 -0
- data/tracks/vimscript/lib/generate.vim +89 -0
- metadata +81 -6
- data/tracks/java/exercises/difference-of-squares/src/main/java/DifferenceOfSquaresCalculator.java +0 -15
- data/tracks/ocaml/.vscode/launch.json +0 -13
@@ -1,5 +1,3 @@
|
|
1
|
-
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
|
2
|
-
|
3
1
|
> There are 10 types of people in the world: Those who understand
|
4
2
|
> binary, and those who don't.
|
5
3
|
|
@@ -16,6 +14,8 @@ binary decide to come up with a secret "handshake".
|
|
16
14
|
10000 = Reverse the order of the operations in the secret handshake.
|
17
15
|
```
|
18
16
|
|
17
|
+
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
|
18
|
+
|
19
19
|
Here's a couple of examples:
|
20
20
|
|
21
21
|
Given the input 3, the function would return the array
|
@@ -1,4 +1,5 @@
|
|
1
|
-
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given
|
1
|
+
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given
|
2
|
+
number.
|
2
3
|
|
3
4
|
The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
|
4
5
|
prime numbers up to any given limit. It does so by iteratively marking as
|
@@ -1,8 +1,7 @@
|
|
1
|
-
Implement the `keep` and `discard` operation on collections. Given a collection
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
other will return the items for which it is false.
|
1
|
+
Implement the `keep` and `discard` operation on collections. Given a collection
|
2
|
+
and a predicate on the collection's elements, `keep` returns a new collection
|
3
|
+
containing those elements where the predicate is true, while `discard` returns
|
4
|
+
a new collection containing those elements where the predicate is false.
|
6
5
|
|
7
6
|
For example, given the collection of numbers:
|
8
7
|
|
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
contained within the second list, if the second list is contained within
|
5
|
-
the first list, if both lists are contained within each other or if none
|
6
|
-
of these are true.
|
1
|
+
Given two lists determine if the first list is contained within the second
|
2
|
+
list, if the second list is contained within the first list, if both lists are
|
3
|
+
contained within each other or if none of these are true.
|
7
4
|
|
8
5
|
Specifically, a list A is a sublist of list B if by dropping 0 or more elements
|
9
6
|
from the front of B and 0 or more elements from the back of B you get a list
|
@@ -1,4 +1,5 @@
|
|
1
|
-
Given a number, find the sum of all the multiples of particular numbers up to
|
1
|
+
Given a number, find the sum of all the multiples of particular numbers up to
|
2
|
+
but not including that number.
|
2
3
|
|
3
4
|
If we list all the natural numbers up to but not including 20 that are
|
4
5
|
multiples of either 3 or 5, we get 3, 5, 6 and 9, 10, 12, 15, and 18.
|
@@ -1,6 +1,7 @@
|
|
1
|
-
Tally the results of a small football competition.
|
2
|
-
|
3
|
-
|
1
|
+
Tally the results of a small football competition.
|
2
|
+
|
3
|
+
Based on an input file containing which team played against which and what the
|
4
|
+
outcome was, create a file with a table like this:
|
4
5
|
|
5
6
|
```
|
6
7
|
Team | MP | W | D | L | P
|
@@ -1,5 +1,3 @@
|
|
1
|
-
Take input text and output it transposed.
|
2
|
-
|
3
1
|
Given an input text output it transposed.
|
4
2
|
|
5
3
|
Roughly explained, the transpose of a matrix:
|
@@ -56,4 +54,4 @@ BE
|
|
56
54
|
|
57
55
|
In general, all characters from the input should also be present in the transposed output.
|
58
56
|
That means that if a column in the input text contains only spaces on its bottom-most row(s),
|
59
|
-
the corresponding output row should contain the spaces in its right-most column(s).
|
57
|
+
the corresponding output row should contain the spaces in its right-most column(s).
|
@@ -1,4 +1,5 @@
|
|
1
|
-
Convert a trinary number, represented as a string (e.g. '102012'), to its
|
1
|
+
Convert a trinary number, represented as a string (e.g. '102012'), to its
|
2
|
+
decimal equivalent using first principles.
|
2
3
|
|
3
4
|
The program should consider strings specifying an invalid trinary as the
|
4
5
|
value 0.
|
@@ -1,5 +1,3 @@
|
|
1
|
-
Given two buckets of different size, demonstrate how to measure an exact number of liters.
|
2
|
-
|
3
1
|
Given two buckets of different size, demonstrate how to measure an exact number of liters by strategically transferring liters of fluid between the buckets.
|
4
2
|
|
5
3
|
Since this mathematical problem is fairly subject to interpretation / individual approach, the tests have been written specifically to expect one overarching solution.
|
@@ -27,4 +25,4 @@ To conclude, the only valid moves are:
|
|
27
25
|
- emptying one bucket and doing nothing to the other
|
28
26
|
- filling one bucket and doing nothing to the other
|
29
27
|
|
30
|
-
Written with <3 at [Fullstack Academy](http://www.fullstackacademy.com/) by [Lindsay](http://lindsaylevine.com).
|
28
|
+
Written with <3 at [Fullstack Academy](http://www.fullstackacademy.com/) by [Lindsay](http://lindsaylevine.com).
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"exercise": "two-fer",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"cases": [
|
5
|
+
{
|
6
|
+
"description": "no name given",
|
7
|
+
"property": "twoFer",
|
8
|
+
"input": null,
|
9
|
+
"expected": "One for you, one for me."
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"description": "a name given",
|
13
|
+
"property": "twoFer",
|
14
|
+
"input": "Alice",
|
15
|
+
"expected": "One for Alice, one for me."
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"description": "another name given",
|
19
|
+
"property": "twoFer",
|
20
|
+
"input": "Bob",
|
21
|
+
"expected": "One for Bob, one for me."
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
2
|
+
|
3
|
+
```
|
4
|
+
"One for X, one for me."
|
5
|
+
```
|
6
|
+
|
7
|
+
When X is a name or "you".
|
8
|
+
|
9
|
+
If the given name is "Alice", the result should be "One for Alice, one for me."
|
10
|
+
If no name is given, the result should be "One for you, one for me."
|
11
|
+
|
12
|
+
|
13
|
+
## Test-Driven Development
|
14
|
+
|
15
|
+
As programmers mature, they eventually want to test their code.
|
16
|
+
|
17
|
+
Here at Exercism we simulate [Test-Driven
|
18
|
+
Development](http://en.wikipedia.org/wiki/Test-driven_development) (TDD), where
|
19
|
+
you write your tests before writing any functionality. The simulation comes in
|
20
|
+
the form of a pre-written test suite, which will signal that you have solved
|
21
|
+
the problem.
|
22
|
+
|
23
|
+
It will also provide you with a safety net to explore other solutions without
|
24
|
+
breaking the functionality.
|
25
|
+
|
26
|
+
### A typical TDD workflow on Exercism:
|
27
|
+
|
28
|
+
1. Run the test file and pick one test that's failing.
|
29
|
+
2. Write some code to fix the test you picked.
|
30
|
+
3. Re-run the tests to confirm the test is now passing.
|
31
|
+
4. Repeat from step 1.
|
32
|
+
5. Submit your solution (`exercism submit /path/to/file`)
|
33
|
+
|
34
|
+
## Instructions
|
35
|
+
|
36
|
+
Submissions are encouraged to be general, within reason. Having said that, it's
|
37
|
+
also important not to over-engineer a solution.
|
38
|
+
|
39
|
+
It's important to remember that the goal is to make code as expressive and
|
40
|
+
readable as we can.
|
@@ -1,5 +1,3 @@
|
|
1
|
-
Create a program to solve a word search puzzle.
|
2
|
-
|
3
1
|
In word search puzzles you get a square of letters and have to find specific
|
4
2
|
words in them.
|
5
3
|
|
@@ -23,5 +21,5 @@ There are several programming languages hidden in the above square.
|
|
23
21
|
Words can be hidden in all kinds of directions: left-to-right, right-to-left,
|
24
22
|
vertical and diagonal.
|
25
23
|
|
26
|
-
|
27
|
-
|
24
|
+
Given a puzzle and a list of words return the location of the first and last
|
25
|
+
letter of each word.
|
@@ -18,7 +18,7 @@ Solve the zebra puzzle.
|
|
18
18
|
|
19
19
|
Each of the five houses is painted a different color, and their
|
20
20
|
inhabitants are of different national extractions, own different pets,
|
21
|
-
drink different beverages and smoke different brands of
|
21
|
+
drink different beverages and smoke different brands of cigarettes.
|
22
22
|
|
23
23
|
Which of the residents drinks water?
|
24
24
|
Who owns the zebra?
|
data/lib/trackler.rb
CHANGED
@@ -6,6 +6,7 @@ module Trackler
|
|
6
6
|
@path = nil
|
7
7
|
@implementations = nil
|
8
8
|
@problems = nil
|
9
|
+
@specifications = nil
|
9
10
|
@tracks = nil
|
10
11
|
@todos = nil
|
11
12
|
end
|
@@ -24,6 +25,10 @@ module Trackler
|
|
24
25
|
@path = Trackler::Path.fixtures
|
25
26
|
end
|
26
27
|
|
28
|
+
def self.specifications
|
29
|
+
@specifications ||= Specifications.new(path)
|
30
|
+
end
|
31
|
+
|
27
32
|
def self.problems
|
28
33
|
@problems ||= Problems.new(path)
|
29
34
|
end
|
@@ -47,15 +52,15 @@ module Trackler
|
|
47
52
|
def self.todos
|
48
53
|
return @todos if !!@todos
|
49
54
|
|
50
|
-
slugs =
|
55
|
+
slugs = specifications.map(&:slug)
|
51
56
|
|
52
57
|
@todos = Hash.new { |h, k| h[k] = [] }
|
53
58
|
tracks.each do |track|
|
54
59
|
todos = slugs - track.slugs
|
55
|
-
@todos[track.id] =
|
56
|
-
todos.include?(
|
57
|
-
}.sort_by { |
|
58
|
-
[implementations[
|
60
|
+
@todos[track.id] = specifications.select { |specification|
|
61
|
+
todos.include?(specification.slug)
|
62
|
+
}.sort_by { |specification|
|
63
|
+
[implementations[specification.slug].count * -1, specification.name]
|
59
64
|
}
|
60
65
|
end
|
61
66
|
@todos
|
data/lib/trackler/description.rb
CHANGED
@@ -2,8 +2,8 @@ require_relative 'guaranteed_file'
|
|
2
2
|
|
3
3
|
module Trackler
|
4
4
|
class Description
|
5
|
-
def self.for(
|
6
|
-
new(GuaranteedFile.for(
|
5
|
+
def self.for(specification:, track: )
|
6
|
+
new(GuaranteedFile.for(specification: specification, track: track, filename: 'description.md'))
|
7
7
|
end
|
8
8
|
|
9
9
|
def initialize(description_file)
|
@@ -2,47 +2,47 @@ module Trackler
|
|
2
2
|
class GuaranteedFile
|
3
3
|
attr_accessor :content
|
4
4
|
|
5
|
-
def self.for(
|
5
|
+
def self.for(specification:, track:, filename:)
|
6
6
|
[TrackFile, CommonFile].detect(-> {NullFile}) do |d|
|
7
|
-
d.send(:exists?,
|
8
|
-
end.send(:new,
|
7
|
+
d.send(:exists?, specification: specification, track: track, filename: filename)
|
8
|
+
end.send(:new, specification: specification, track: track, filename: filename)
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
attr_accessor :
|
13
|
+
attr_accessor :track, :filename, :specification
|
14
14
|
|
15
|
-
def self.exists?(
|
16
|
-
File.exists?(location(
|
15
|
+
def self.exists?(specification:, track:, filename:)
|
16
|
+
File.exists?(location(specification: specification, track: track, filename: filename))
|
17
17
|
end
|
18
18
|
private_class_method :exists?
|
19
19
|
|
20
|
-
def initialize(
|
21
|
-
self.
|
20
|
+
def initialize(specification:, track:, filename:)
|
21
|
+
self.specification = specification
|
22
22
|
self.track = track
|
23
23
|
self.filename = filename
|
24
|
-
self.content = File.read(self.class.location(
|
24
|
+
self.content = File.read(self.class.location(specification: specification, track: track, filename: filename))
|
25
25
|
end
|
26
26
|
private_class_method :new
|
27
27
|
end
|
28
28
|
|
29
29
|
class TrackFile < GuaranteedFile
|
30
|
-
def self.location(
|
31
|
-
File.join(
|
30
|
+
def self.location(specification:, track:, filename:)
|
31
|
+
File.join(specification.root, 'tracks', track.id, 'exercises', specification.slug, '.meta', filename)
|
32
32
|
end
|
33
33
|
|
34
34
|
def url
|
35
|
-
"#{track.repository}/blob/master/exercises/%s/.meta/#{filename}" %
|
35
|
+
"#{track.repository}/blob/master/exercises/%s/.meta/#{filename}" % specification.slug
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
class CommonFile < GuaranteedFile
|
40
|
-
def self.location(
|
41
|
-
File.join(
|
40
|
+
def self.location(specification:, filename:, **_track)
|
41
|
+
File.join(specification.root, 'common', 'exercises', specification.slug, filename)
|
42
42
|
end
|
43
43
|
|
44
44
|
def url
|
45
|
-
"https://github.com/exercism/x-common/blob/master/exercises/%s/#{filename}" %
|
45
|
+
"https://github.com/exercism/x-common/blob/master/exercises/%s/#{filename}" % specification.slug
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -12,12 +12,12 @@ module Trackler
|
|
12
12
|
]
|
13
13
|
|
14
14
|
extend Forwardable
|
15
|
-
def_delegators :@
|
15
|
+
def_delegators :@specification, :name, :blurb, :description, :source_markdown, :slug, :source, :metadata, :root, :active?, :deprecated?, :source_url, :description_url, :canonical_data_url, :metadata_url
|
16
16
|
def_delegators :@track, :language
|
17
17
|
|
18
|
-
def initialize(track,
|
18
|
+
def initialize(track, specification)
|
19
19
|
@track = track
|
20
|
-
@
|
20
|
+
@specification = specification
|
21
21
|
end
|
22
22
|
|
23
23
|
def initialize_copy(original)
|
@@ -27,7 +27,7 @@ module Trackler
|
|
27
27
|
|
28
28
|
def problem
|
29
29
|
warn "DEPRECATION WARNING: The `problem` method is deprecated, Implementation can do everything that Problem can, so call the method directly."
|
30
|
-
@
|
30
|
+
@specification
|
31
31
|
end
|
32
32
|
|
33
33
|
def exists?
|
@@ -106,7 +106,7 @@ module Trackler
|
|
106
106
|
|
107
107
|
def incomplete_solutions_body
|
108
108
|
<<-README
|
109
|
-
## Submitting Incomplete
|
109
|
+
## Submitting Incomplete Solutions
|
110
110
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
111
111
|
README
|
112
112
|
end
|
@@ -31,7 +31,7 @@ module Trackler
|
|
31
31
|
|
32
32
|
def all
|
33
33
|
@all ||= slugs.map { |slug|
|
34
|
-
Implementation.new(track,
|
34
|
+
Implementation.new(track, Specification.new(slug, root, track))
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
@@ -41,7 +41,7 @@ module Trackler
|
|
41
41
|
|
42
42
|
def implementation_map
|
43
43
|
hash = Hash.new { |_, k|
|
44
|
-
Implementation.new(track,
|
44
|
+
Implementation.new(track, Specification.new(k, root, track))
|
45
45
|
}
|
46
46
|
all.each do |impl|
|
47
47
|
hash[impl.slug] = impl
|
data/lib/trackler/metadata.rb
CHANGED
@@ -2,8 +2,8 @@ require_relative 'guaranteed_file'
|
|
2
2
|
|
3
3
|
module Trackler
|
4
4
|
class Metadata
|
5
|
-
def self.for(
|
6
|
-
new(GuaranteedFile.for(
|
5
|
+
def self.for(specification: , track: )
|
6
|
+
new(GuaranteedFile.for(specification: specification, track: track, filename: 'metadata.yml'))
|
7
7
|
end
|
8
8
|
|
9
9
|
attr_accessor :blurb, :source, :source_url
|
data/lib/trackler/problem.rb
CHANGED
@@ -1,101 +1,7 @@
|
|
1
|
-
|
2
|
-
require_relative 'metadata'
|
3
|
-
require_relative 'description'
|
4
|
-
require_relative 'null_track'
|
1
|
+
require_relative 'specification'
|
5
2
|
|
6
3
|
module Trackler
|
7
4
|
# Problem is a language-independent definition of an exercise.
|
8
|
-
class Problem
|
9
|
-
attr_reader :slug, :root, :metadata
|
10
|
-
def initialize(slug, root, track = NullTrack.new)
|
11
|
-
@slug = slug
|
12
|
-
@root = root
|
13
|
-
@file_root = File.join(root, 'common', 'exercises', self.slug)
|
14
|
-
@repo_root = "https://github.com/exercism/x-common/blob/master/exercises/%s/" % self.slug
|
15
|
-
|
16
|
-
@metadata = Metadata.for(problem: self, track: track)
|
17
|
-
self.description_object = Description.for(problem: self, track: track)
|
18
|
-
end
|
19
|
-
|
20
|
-
def exists?
|
21
|
-
description_object.exists? && metadata.exists?
|
22
|
-
end
|
23
|
-
|
24
|
-
def deprecated?
|
25
|
-
@deprecated ||= File.exists?(file_path(deprecation_file_name, @file_root))
|
26
|
-
end
|
27
|
-
|
28
|
-
def active?
|
29
|
-
exists? && !deprecated?
|
30
|
-
end
|
31
|
-
|
32
|
-
def name
|
33
|
-
slug.split('-').map(&:capitalize).join(' ')
|
34
|
-
end
|
35
|
-
|
36
|
-
def description
|
37
|
-
description_object.to_s
|
38
|
-
end
|
39
|
-
|
40
|
-
def source_markdown
|
41
|
-
text = [source, markdown_link(source_url)].reject(&:empty?).join(" ")
|
42
|
-
text.empty? ? text : "## Source\n\n#{text}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def description_url
|
46
|
-
description_object.url
|
47
|
-
end
|
48
|
-
|
49
|
-
def canonical_data_url
|
50
|
-
repo_url(canonical_data_file_name) if File.exists?(file_path(canonical_data_file_name, @file_root))
|
51
|
-
end
|
52
|
-
|
53
|
-
def metadata_url
|
54
|
-
metadata.url
|
55
|
-
end
|
56
|
-
|
57
|
-
def blurb
|
58
|
-
metadata.blurb
|
59
|
-
end
|
60
|
-
|
61
|
-
def source
|
62
|
-
metadata.source
|
63
|
-
end
|
64
|
-
|
65
|
-
def source_url
|
66
|
-
metadata.source_url
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
attr_accessor :description_object
|
72
|
-
|
73
|
-
def canonical_data_file_name
|
74
|
-
"canonical-data.json"
|
75
|
-
end
|
76
|
-
|
77
|
-
def description_file_name
|
78
|
-
"description.md"
|
79
|
-
end
|
80
|
-
|
81
|
-
def metadata_file_name
|
82
|
-
"metadata.yml"
|
83
|
-
end
|
84
|
-
|
85
|
-
def deprecation_file_name
|
86
|
-
".deprecated"
|
87
|
-
end
|
88
|
-
|
89
|
-
def repo_url(filename)
|
90
|
-
@repo_root + filename
|
91
|
-
end
|
92
|
-
|
93
|
-
def file_path(filename, root = @file_root)
|
94
|
-
File.join(root, filename)
|
95
|
-
end
|
96
|
-
|
97
|
-
def markdown_link(url)
|
98
|
-
url.empty? ? url : format("[%s](%s)", url, url)
|
99
|
-
end
|
5
|
+
class Problem < Trackler::Specification
|
100
6
|
end
|
101
7
|
end
|