trackler 2.2.1.82 → 2.2.1.83

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/bash/.gitattributes +10 -0
  4. data/tracks/bash/CONTRIBUTING.md +3 -1
  5. data/tracks/{java/_template/src/example/java → bash/_template/.meta}/.keep +0 -0
  6. data/tracks/bash/_template/README.md +11 -0
  7. data/tracks/bash/_template/example.sh +3 -0
  8. data/tracks/bash/_template/exercise_slug_test.sh +17 -0
  9. data/tracks/bash/exercises/acronym/example.sh +1 -1
  10. data/tracks/bash/exercises/anagram/example.sh +1 -1
  11. data/tracks/bash/exercises/armstrong-numbers/example.sh +1 -1
  12. data/tracks/bash/exercises/atbash-cipher/example.sh +1 -1
  13. data/tracks/bash/exercises/bob/example.sh +1 -1
  14. data/tracks/bash/exercises/error-handling/example.sh +2 -0
  15. data/tracks/bash/exercises/gigasecond/example.sh +2 -0
  16. data/tracks/bash/exercises/hamming/example.sh +1 -1
  17. data/tracks/bash/exercises/hello-world/example.sh +1 -1
  18. data/tracks/bash/exercises/leap/example.sh +1 -1
  19. data/tracks/bash/exercises/nucleotide-count/example.sh +1 -1
  20. data/tracks/bash/exercises/pangram/example.sh +1 -1
  21. data/tracks/bash/exercises/raindrops/example.sh +1 -1
  22. data/tracks/bash/exercises/reverse-string/example.sh +1 -1
  23. data/tracks/bash/exercises/rna-transcription/example.sh +2 -0
  24. data/tracks/bash/exercises/roman-numerals/example.sh +1 -1
  25. data/tracks/bash/exercises/triangle/example.sh +3 -2
  26. data/tracks/bash/exercises/two-fer/example.sh +1 -1
  27. data/tracks/bash/exercises/word-count/example.sh +2 -2
  28. data/tracks/clojure/config.json +8 -0
  29. data/tracks/clojure/exercises/armstrong-numbers/README.md +19 -0
  30. data/tracks/clojure/exercises/armstrong-numbers/project.clj +4 -0
  31. data/tracks/clojure/exercises/armstrong-numbers/src/armstrong_numbers.clj +3 -0
  32. data/tracks/clojure/exercises/armstrong-numbers/src/example.clj +6 -0
  33. data/tracks/clojure/exercises/armstrong-numbers/test/armstrong_numbers_test.clj +35 -0
  34. data/tracks/common-lisp/exercises/sieve/example.lisp +10 -11
  35. data/tracks/common-lisp/exercises/sieve/sieve-test.lisp +30 -20
  36. data/tracks/go/exercises/all-your-base/all_your_base_test.go +5 -4
  37. data/tracks/go/exercises/pig-latin/.meta/gen.go +58 -0
  38. data/tracks/go/exercises/pig-latin/cases_test.go +122 -0
  39. data/tracks/go/exercises/pig-latin/example.go +20 -8
  40. data/tracks/go/exercises/pig-latin/pig_latin_test.go +9 -23
  41. data/tracks/java/_template/.meta/src/reference/java/.keep +0 -0
  42. data/tracks/java/exercises/acronym/.meta/src/reference/java/Acronym.java +8 -10
  43. data/tracks/java/exercises/anagram/.meta/src/reference/java/Anagram.java +4 -9
  44. data/tracks/java/exercises/atbash-cipher/.meta/src/reference/java/Atbash.java +2 -10
  45. data/tracks/java/exercises/hamming/.meta/version +1 -1
  46. data/tracks/java/exercises/hamming/src/test/java/HammingTest.java +3 -2
  47. data/tracks/java/exercises/isogram/.meta/version +1 -0
  48. data/tracks/java/exercises/isogram/src/test/java/IsogramCheckerTest.java +14 -21
  49. data/tracks/ruby/config.json +14 -2
  50. data/tracks/ruby/exercises/book-store/.meta/generator/book_store_case.rb +9 -0
  51. data/tracks/ruby/exercises/book-store/.meta/solutions/.version +1 -0
  52. data/tracks/ruby/exercises/book-store/.meta/solutions/book_store.rb +47 -0
  53. data/tracks/ruby/exercises/book-store/README.md +100 -0
  54. data/tracks/ruby/exercises/book-store/book_store_test.rb +97 -0
  55. data/tracks/ruby/exercises/change/README.md +49 -0
  56. metadata +22 -3
@@ -0,0 +1,100 @@
1
+ # Book Store
2
+
3
+ To try and encourage more sales of different books from a popular 5 book
4
+ series, a bookshop has decided to offer discounts on multiple book purchases.
5
+
6
+ One copy of any of the five books costs $8.
7
+
8
+ If, however, you buy two different books, you get a 5%
9
+ discount on those two books.
10
+
11
+ If you buy 3 different books, you get a 10% discount.
12
+
13
+ If you buy 4 different books, you get a 20% discount.
14
+
15
+ If you buy all 5, you get a 25% discount.
16
+
17
+ Note: that if you buy four books, of which 3 are
18
+ different titles, you get a 10% discount on the 3 that
19
+ form part of a set, but the fourth book still costs $8.
20
+
21
+ Your mission is to write a piece of code to calculate the
22
+ price of any conceivable shopping basket (containing only
23
+ books of the same series), giving as big a discount as
24
+ possible.
25
+
26
+ For example, how much does this basket of books cost?
27
+
28
+ - 2 copies of the first book
29
+ - 2 copies of the second book
30
+ - 2 copies of the third book
31
+ - 1 copy of the fourth book
32
+ - 1 copy of the fifth book
33
+
34
+ One way of grouping these 8 books is:
35
+
36
+ - 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th)
37
+ - +1 group of 3 --> 10% discount (1st,2nd,3rd)
38
+
39
+ This would give a total of:
40
+
41
+ - 5 books at a 25% discount
42
+ - +3 books at a 10% discount
43
+
44
+ Resulting in:
45
+
46
+ - 5 x (8 - 2.00) == 5 x 6.00 == $30.00
47
+ - +3 x (8 - 0.80) == 3 x 7.20 == $21.60
48
+
49
+ For a total of $51.60
50
+
51
+ However, a different way to group these 8 books is:
52
+
53
+ - 1 group of 4 books --> 20% discount (1st,2nd,3rd,4th)
54
+ - +1 group of 4 books --> 20% discount (1st,2nd,3rd,5th)
55
+
56
+ This would give a total of:
57
+
58
+ - 4 books at a 20% discount
59
+ - +4 books at a 20% discount
60
+
61
+ Resulting in:
62
+
63
+ - 4 x (8 - 1.60) == 4 x 6.40 == $25.60
64
+ - +4 x (8 - 1.60) == 4 x 6.40 == $25.60
65
+
66
+ For a total of $51.20
67
+
68
+ And $51.20 is the price with the biggest discount.
69
+
70
+ * * * *
71
+
72
+ For installation and learning resources, refer to the
73
+ [exercism help page](http://exercism.io/languages/ruby).
74
+
75
+ For running the tests provided, you will need the Minitest gem. Open a
76
+ terminal window and run the following command to install minitest:
77
+
78
+ gem install minitest
79
+
80
+ If you would like color output, you can `require 'minitest/pride'` in
81
+ the test file, or note the alternative instruction, below, for running
82
+ the test file.
83
+
84
+ In order to run the test, you can run the test file from the exercise
85
+ directory. For example, if the test suite is called
86
+ `hello_world_test.rb`, you can run the following command:
87
+
88
+ ruby hello_world_test.rb
89
+
90
+ To include color from the command line:
91
+
92
+ ruby -r minitest/pride hello_world_test.rb
93
+
94
+
95
+ ## Source
96
+
97
+ Inspired by the harry potter kata from Cyber-Dojo. [http://cyber-dojo.org](http://cyber-dojo.org)
98
+
99
+ ## Submitting Incomplete Solutions
100
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,97 @@
1
+ require 'minitest/autorun'
2
+ require_relative 'book_store'
3
+
4
+ # Common test data version: 1.1.0 a636903
5
+ class BookStoreTest < Minitest::Test
6
+ def test_only_a_single_book
7
+ # skip
8
+ assert_equal 8.0, BookStore.calculate_price([1])
9
+ end
10
+
11
+ def test_two_of_the_same_book
12
+ skip
13
+ assert_equal 16.0, BookStore.calculate_price([2, 2])
14
+ end
15
+
16
+ def test_empty_basket
17
+ skip
18
+ assert_equal 0.0, BookStore.calculate_price([])
19
+ end
20
+
21
+ def test_two_different_books
22
+ skip
23
+ assert_equal 15.2, BookStore.calculate_price([1, 2])
24
+ end
25
+
26
+ def test_three_different_books
27
+ skip
28
+ assert_equal 21.6, BookStore.calculate_price([1, 2, 3])
29
+ end
30
+
31
+ def test_four_different_books
32
+ skip
33
+ assert_equal 25.6, BookStore.calculate_price([1, 2, 3, 4])
34
+ end
35
+
36
+ def test_five_different_books
37
+ skip
38
+ assert_equal 30.0, BookStore.calculate_price([1, 2, 3, 4, 5])
39
+ end
40
+
41
+ def test_two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three
42
+ skip
43
+ assert_equal 51.2, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 5])
44
+ end
45
+
46
+ def test_group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three
47
+ skip
48
+ assert_equal 40.8, BookStore.calculate_price([1, 1, 2, 2, 3, 4])
49
+ end
50
+
51
+ def test_two_each_of_first_4_books_and_1_copy_each_of_rest
52
+ skip
53
+ assert_equal 55.6, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5])
54
+ end
55
+
56
+ def test_two_copies_of_each_book
57
+ skip
58
+ assert_equal 60.0, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5, 5])
59
+ end
60
+
61
+ def test_three_copies_of_first_book_and_2_each_of_remaining
62
+ skip
63
+ assert_equal 68.0, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1])
64
+ end
65
+
66
+ def test_three_each_of_first_2_books_and_2_each_of_remaining_books
67
+ skip
68
+ assert_equal 75.2, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2])
69
+ end
70
+
71
+ def test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three
72
+ skip
73
+ assert_equal 102.4, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5])
74
+ end
75
+
76
+ # Problems in exercism evolve over time, as we find better ways to ask
77
+ # questions.
78
+ # The version number refers to the version of the problem you solved,
79
+ # not your solution.
80
+ #
81
+ # Define a constant named VERSION inside of the top level BookKeeping
82
+ # module, which may be placed near the end of your file.
83
+ #
84
+ # In your file, it will look like this:
85
+ #
86
+ # module BookKeeping
87
+ # VERSION = 1 # Where the version number matches the one in the test.
88
+ # end
89
+ #
90
+ # If you are curious, read more about constants on RubyDoc:
91
+ # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html
92
+
93
+ def test_bookkeeping
94
+ skip
95
+ assert_equal 0, BookKeeping::VERSION
96
+ end
97
+ end
@@ -0,0 +1,49 @@
1
+ # Change
2
+
3
+ Correctly determine the fewest number of coins to be given to a customer such
4
+ that the sum of the coins' value would equal the correct amount of change.
5
+
6
+ ## For example
7
+
8
+ - An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5)
9
+ and one dime (10) or [0, 1, 1, 0, 0]
10
+ - An input of 40 with [1, 5, 10, 25, 100] should return one nickel (5)
11
+ and one dime (10) and one quarter (25) or [0, 1, 1, 1, 0]
12
+
13
+ ## Edge cases
14
+
15
+ - Does your algorithm work for any given set of coins?
16
+ - Can you ask for negative change?
17
+ - Can you ask for a change value smaller than the smallest coin value?
18
+
19
+ * * * *
20
+
21
+ For installation and learning resources, refer to the
22
+ [exercism help page](http://exercism.io/languages/ruby).
23
+
24
+ For running the tests provided, you will need the Minitest gem. Open a
25
+ terminal window and run the following command to install minitest:
26
+
27
+ gem install minitest
28
+
29
+ If you would like color output, you can `require 'minitest/pride'` in
30
+ the test file, or note the alternative instruction, below, for running
31
+ the test file.
32
+
33
+ In order to run the test, you can run the test file from the exercise
34
+ directory. For example, if the test suite is called
35
+ `hello_world_test.rb`, you can run the following command:
36
+
37
+ ruby hello_world_test.rb
38
+
39
+ To include color from the command line:
40
+
41
+ ruby -r minitest/pride hello_world_test.rb
42
+
43
+
44
+ ## Source
45
+
46
+ Software Craftsmanship - Coin Change Kata [https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata](https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata)
47
+
48
+ ## Submitting Incomplete Solutions
49
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.82
4
+ version: 2.2.1.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-01 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -584,11 +584,16 @@ files:
584
584
  - problem-specifications/yarn.lock
585
585
  - trackler.gemspec
586
586
  - tracks/bash/.git
587
+ - tracks/bash/.gitattributes
587
588
  - tracks/bash/.gitignore
588
589
  - tracks/bash/.travis.yml
589
590
  - tracks/bash/CONTRIBUTING.md
590
591
  - tracks/bash/LICENSE
591
592
  - tracks/bash/README.md
593
+ - tracks/bash/_template/.meta/.keep
594
+ - tracks/bash/_template/README.md
595
+ - tracks/bash/_template/example.sh
596
+ - tracks/bash/_template/exercise_slug_test.sh
592
597
  - tracks/bash/bin/fetch-configlet
593
598
  - tracks/bash/config.json
594
599
  - tracks/bash/config/exercise_readme.go.tmpl
@@ -1417,6 +1422,11 @@ files:
1417
1422
  - tracks/clojure/exercises/anagram/src/anagram.clj
1418
1423
  - tracks/clojure/exercises/anagram/src/example.clj
1419
1424
  - tracks/clojure/exercises/anagram/test/anagram_test.clj
1425
+ - tracks/clojure/exercises/armstrong-numbers/README.md
1426
+ - tracks/clojure/exercises/armstrong-numbers/project.clj
1427
+ - tracks/clojure/exercises/armstrong-numbers/src/armstrong_numbers.clj
1428
+ - tracks/clojure/exercises/armstrong-numbers/src/example.clj
1429
+ - tracks/clojure/exercises/armstrong-numbers/test/armstrong_numbers_test.clj
1420
1430
  - tracks/clojure/exercises/atbash-cipher/README.md
1421
1431
  - tracks/clojure/exercises/atbash-cipher/project.clj
1422
1432
  - tracks/clojure/exercises/atbash-cipher/src/atbash_cipher.clj
@@ -6084,7 +6094,9 @@ files:
6084
6094
  - tracks/go/exercises/phone-number/cases_test.go
6085
6095
  - tracks/go/exercises/phone-number/example.go
6086
6096
  - tracks/go/exercises/phone-number/phone_number_test.go
6097
+ - tracks/go/exercises/pig-latin/.meta/gen.go
6087
6098
  - tracks/go/exercises/pig-latin/README.md
6099
+ - tracks/go/exercises/pig-latin/cases_test.go
6088
6100
  - tracks/go/exercises/pig-latin/example.go
6089
6101
  - tracks/go/exercises/pig-latin/pig_latin_test.go
6090
6102
  - tracks/go/exercises/poker/.meta/gen.go
@@ -7168,8 +7180,8 @@ files:
7168
7180
  - tracks/java/LICENSE
7169
7181
  - tracks/java/POLICIES.md
7170
7182
  - tracks/java/README.md
7183
+ - tracks/java/_template/.meta/src/reference/java/.keep
7171
7184
  - tracks/java/_template/build.gradle
7172
- - tracks/java/_template/src/example/java/.keep
7173
7185
  - tracks/java/_template/src/main/java/.keep
7174
7186
  - tracks/java/_template/src/test/java/.keep
7175
7187
  - tracks/java/bin/README.md
@@ -7401,6 +7413,7 @@ files:
7401
7413
  - tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java
7402
7414
  - tracks/java/exercises/isogram/.meta/hints.md
7403
7415
  - tracks/java/exercises/isogram/.meta/src/reference/java/IsogramChecker.java
7416
+ - tracks/java/exercises/isogram/.meta/version
7404
7417
  - tracks/java/exercises/isogram/README.md
7405
7418
  - tracks/java/exercises/isogram/build.gradle
7406
7419
  - tracks/java/exercises/isogram/src/main/java/IsogramChecker.java
@@ -11617,6 +11630,11 @@ files:
11617
11630
  - tracks/ruby/exercises/bob/.meta/solutions/bob.rb
11618
11631
  - tracks/ruby/exercises/bob/README.md
11619
11632
  - tracks/ruby/exercises/bob/bob_test.rb
11633
+ - tracks/ruby/exercises/book-store/.meta/generator/book_store_case.rb
11634
+ - tracks/ruby/exercises/book-store/.meta/solutions/.version
11635
+ - tracks/ruby/exercises/book-store/.meta/solutions/book_store.rb
11636
+ - tracks/ruby/exercises/book-store/README.md
11637
+ - tracks/ruby/exercises/book-store/book_store_test.rb
11620
11638
  - tracks/ruby/exercises/bowling/.meta/.version
11621
11639
  - tracks/ruby/exercises/bowling/.meta/generator/bowling_case.rb
11622
11640
  - tracks/ruby/exercises/bowling/.meta/generator/test_template.erb
@@ -11631,6 +11649,7 @@ files:
11631
11649
  - tracks/ruby/exercises/change/.meta/.version
11632
11650
  - tracks/ruby/exercises/change/.meta/generator/change_case.rb
11633
11651
  - tracks/ruby/exercises/change/.meta/solutions/change.rb
11652
+ - tracks/ruby/exercises/change/README.md
11634
11653
  - tracks/ruby/exercises/change/change_test.rb
11635
11654
  - tracks/ruby/exercises/circular-buffer/.meta/solutions/circular_buffer.rb
11636
11655
  - tracks/ruby/exercises/circular-buffer/README.md