trackler 2.2.1.85 → 2.2.1.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/alphametics/canonical-data.json +29 -11
  4. data/problem-specifications/exercises/binary-search-tree/canonical-data.json +177 -0
  5. data/problem-specifications/package.json +2 -2
  6. data/problem-specifications/yarn.lock +61 -51
  7. data/tracks/bash/CONTRIBUTING.md +10 -6
  8. data/tracks/bash/README.md +1 -0
  9. data/tracks/bash/exercises/acronym/README.md +1 -1
  10. data/tracks/bash/exercises/anagram/README.md +1 -1
  11. data/tracks/bash/exercises/anagram/{anagram_tests.sh → anagram_test.sh} +0 -0
  12. data/tracks/bash/exercises/armstrong-numbers/armstrong_numbers_test.sh +25 -17
  13. data/tracks/bash/exercises/armstrong-numbers/example.sh +18 -12
  14. data/tracks/bash/exercises/atbash-cipher/README.md +1 -1
  15. data/tracks/bash/exercises/atbash-cipher/{atbash_cipher_tests.sh → atbash_cipher_test.sh} +0 -0
  16. data/tracks/bash/exercises/difference-of-squares/README.md +1 -1
  17. data/tracks/bash/exercises/gigasecond/README.md +1 -1
  18. data/tracks/bash/exercises/hamming/README.md +1 -1
  19. data/tracks/bash/exercises/hello-world/README.md +1 -1
  20. data/tracks/bash/exercises/leap/README.md +1 -1
  21. data/tracks/bash/exercises/luhn/README.md +1 -1
  22. data/tracks/bash/exercises/nucleotide-count/README.md +1 -1
  23. data/tracks/bash/exercises/pangram/README.md +1 -1
  24. data/tracks/bash/exercises/pangram/{pangram_tests.sh → pangram_test.sh} +0 -0
  25. data/tracks/bash/exercises/phone-number/README.md +1 -1
  26. data/tracks/bash/exercises/phone-number/{phone_number_tests.sh → phone_number_test.sh} +0 -0
  27. data/tracks/bash/exercises/raindrops/README.md +1 -1
  28. data/tracks/bash/exercises/rna-transcription/README.md +1 -1
  29. data/tracks/bash/exercises/triangle/example.sh +23 -4
  30. data/tracks/bash/exercises/triangle/triangle_test.sh +17 -0
  31. data/tracks/bash/exercises/two-fer/README.md +1 -1
  32. data/tracks/bash/exercises/word-count/README.md +1 -1
  33. data/tracks/c/config.json +11 -0
  34. data/tracks/c/exercises/complex-numbers/README.md +67 -0
  35. data/tracks/c/exercises/complex-numbers/makefile +27 -0
  36. data/tracks/c/exercises/complex-numbers/src/complex_numbers.c +46 -0
  37. data/tracks/c/exercises/complex-numbers/src/complex_numbers.h +19 -0
  38. data/tracks/c/exercises/complex-numbers/src/example.c +80 -0
  39. data/tracks/c/exercises/complex-numbers/test/test_complex_numbers.c +397 -0
  40. data/tracks/c/exercises/complex-numbers/test/vendor/unity.c +1300 -0
  41. data/tracks/c/exercises/complex-numbers/test/vendor/unity.h +274 -0
  42. data/tracks/c/exercises/complex-numbers/test/vendor/unity_internals.h +701 -0
  43. data/tracks/crystal/.github/stale.yml +18 -0
  44. data/tracks/csharp/exercises/bob/README.md +3 -2
  45. data/tracks/ecmascript/config.json +4 -4
  46. data/tracks/fsharp/exercises/bob/README.md +4 -2
  47. data/tracks/fsharp/exercises/react/ReactTest.fs +137 -74
  48. data/tracks/fsharp/generators/Generators.fs +76 -0
  49. data/tracks/go/exercises/tree-building/tree_test.go +15 -0
  50. data/tracks/haskell/.travis.yml +1 -1
  51. data/tracks/haskell/exercises/accumulate/stack.yaml +1 -1
  52. data/tracks/haskell/exercises/acronym/package.yaml +1 -1
  53. data/tracks/haskell/exercises/acronym/stack.yaml +1 -1
  54. data/tracks/haskell/exercises/all-your-base/package.yaml +1 -1
  55. data/tracks/haskell/exercises/all-your-base/stack.yaml +1 -1
  56. data/tracks/haskell/exercises/all-your-base/test/Tests.hs +6 -6
  57. data/tracks/haskell/exercises/allergies/package.yaml +1 -1
  58. data/tracks/haskell/exercises/allergies/stack.yaml +1 -1
  59. data/tracks/haskell/exercises/alphametics/stack.yaml +1 -1
  60. data/tracks/haskell/exercises/anagram/package.yaml +1 -1
  61. data/tracks/haskell/exercises/anagram/stack.yaml +1 -1
  62. data/tracks/haskell/exercises/atbash-cipher/package.yaml +1 -1
  63. data/tracks/haskell/exercises/atbash-cipher/stack.yaml +1 -1
  64. data/tracks/haskell/exercises/bank-account/stack.yaml +1 -1
  65. data/tracks/haskell/exercises/beer-song/stack.yaml +1 -1
  66. data/tracks/haskell/exercises/binary-search-tree/package.yaml +1 -1
  67. data/tracks/haskell/exercises/binary-search-tree/stack.yaml +1 -1
  68. data/tracks/haskell/exercises/binary-search-tree/test/Tests.hs +3 -0
  69. data/tracks/haskell/exercises/binary/stack.yaml +1 -1
  70. data/tracks/haskell/exercises/bob/package.yaml +1 -1
  71. data/tracks/haskell/exercises/bob/stack.yaml +1 -1
  72. data/tracks/haskell/exercises/bowling/stack.yaml +1 -1
  73. data/tracks/haskell/exercises/bracket-push/package.yaml +1 -1
  74. data/tracks/haskell/exercises/bracket-push/stack.yaml +1 -1
  75. data/tracks/haskell/exercises/change/package.yaml +1 -1
  76. data/tracks/haskell/exercises/change/stack.yaml +1 -1
  77. data/tracks/haskell/exercises/clock/stack.yaml +1 -1
  78. data/tracks/haskell/exercises/collatz-conjecture/package.yaml +1 -1
  79. data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -1
  80. data/tracks/haskell/exercises/complex-numbers/stack.yaml +1 -1
  81. data/tracks/haskell/exercises/connect/package.yaml +1 -1
  82. data/tracks/haskell/exercises/connect/stack.yaml +1 -1
  83. data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
  84. data/tracks/haskell/exercises/crypto-square/stack.yaml +1 -1
  85. data/tracks/haskell/exercises/custom-set/stack.yaml +1 -1
  86. data/tracks/haskell/exercises/diamond/package.yaml +1 -1
  87. data/tracks/haskell/exercises/diamond/stack.yaml +1 -1
  88. data/tracks/haskell/exercises/difference-of-squares/package.yaml +1 -1
  89. data/tracks/haskell/exercises/difference-of-squares/stack.yaml +1 -1
  90. data/tracks/haskell/exercises/dominoes/package.yaml +1 -1
  91. data/tracks/haskell/exercises/dominoes/stack.yaml +1 -1
  92. data/tracks/haskell/exercises/etl/stack.yaml +1 -1
  93. data/tracks/haskell/exercises/food-chain/stack.yaml +1 -1
  94. data/tracks/haskell/exercises/forth/stack.yaml +1 -1
  95. data/tracks/haskell/exercises/gigasecond/stack.yaml +1 -1
  96. data/tracks/haskell/exercises/go-counting/stack.yaml +1 -1
  97. data/tracks/haskell/exercises/grade-school/stack.yaml +1 -1
  98. data/tracks/haskell/exercises/grains/stack.yaml +1 -1
  99. data/tracks/haskell/exercises/hamming/stack.yaml +1 -1
  100. data/tracks/haskell/exercises/hello-world/stack.yaml +1 -1
  101. data/tracks/haskell/exercises/hexadecimal/stack.yaml +1 -1
  102. data/tracks/haskell/exercises/house/stack.yaml +1 -1
  103. data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/src/IsbnVerifier.hs +1 -0
  104. data/tracks/haskell/exercises/isbn-verifier/package.yaml +1 -1
  105. data/tracks/haskell/exercises/isbn-verifier/stack.yaml +1 -1
  106. data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +4 -0
  107. data/tracks/haskell/exercises/isogram/stack.yaml +1 -1
  108. data/tracks/haskell/exercises/kindergarten-garden/stack.yaml +1 -1
  109. data/tracks/haskell/exercises/largest-series-product/stack.yaml +1 -1
  110. data/tracks/haskell/exercises/leap/stack.yaml +1 -1
  111. data/tracks/haskell/exercises/lens-person/stack.yaml +1 -1
  112. data/tracks/haskell/exercises/linked-list/stack.yaml +1 -1
  113. data/tracks/haskell/exercises/list-ops/stack.yaml +1 -1
  114. data/tracks/haskell/exercises/luhn/package.yaml +1 -1
  115. data/tracks/haskell/exercises/luhn/stack.yaml +1 -1
  116. data/tracks/haskell/exercises/luhn/test/Tests.hs +1 -1
  117. data/tracks/haskell/exercises/matrix/stack.yaml +1 -1
  118. data/tracks/haskell/exercises/meetup/package.yaml +1 -1
  119. data/tracks/haskell/exercises/meetup/stack.yaml +1 -1
  120. data/tracks/haskell/exercises/minesweeper/stack.yaml +1 -1
  121. data/tracks/haskell/exercises/nth-prime/stack.yaml +1 -1
  122. data/tracks/haskell/exercises/nucleotide-count/stack.yaml +1 -1
  123. data/tracks/haskell/exercises/ocr-numbers/stack.yaml +1 -1
  124. data/tracks/haskell/exercises/octal/stack.yaml +1 -1
  125. data/tracks/haskell/exercises/palindrome-products/stack.yaml +1 -1
  126. data/tracks/haskell/exercises/pangram/stack.yaml +1 -1
  127. data/tracks/haskell/exercises/parallel-letter-frequency/stack.yaml +1 -1
  128. data/tracks/haskell/exercises/pascals-triangle/stack.yaml +1 -1
  129. data/tracks/haskell/exercises/perfect-numbers/stack.yaml +1 -1
  130. data/tracks/haskell/exercises/phone-number/stack.yaml +1 -1
  131. data/tracks/haskell/exercises/pig-latin/stack.yaml +1 -1
  132. data/tracks/haskell/exercises/pov/stack.yaml +1 -1
  133. data/tracks/haskell/exercises/prime-factors/stack.yaml +1 -1
  134. data/tracks/haskell/exercises/pythagorean-triplet/stack.yaml +1 -1
  135. data/tracks/haskell/exercises/queen-attack/stack.yaml +1 -1
  136. data/tracks/haskell/exercises/rail-fence-cipher/package.yaml +1 -1
  137. data/tracks/haskell/exercises/rail-fence-cipher/stack.yaml +1 -1
  138. data/tracks/haskell/exercises/raindrops/stack.yaml +1 -1
  139. data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -1
  140. data/tracks/haskell/exercises/rna-transcription/stack.yaml +1 -1
  141. data/tracks/haskell/exercises/rna-transcription/test/Tests.hs +0 -12
  142. data/tracks/haskell/exercises/robot-name/stack.yaml +1 -1
  143. data/tracks/haskell/exercises/robot-simulator/stack.yaml +1 -1
  144. data/tracks/haskell/exercises/roman-numerals/stack.yaml +1 -1
  145. data/tracks/haskell/exercises/rotational-cipher/stack.yaml +1 -1
  146. data/tracks/haskell/exercises/run-length-encoding/stack.yaml +1 -1
  147. data/tracks/haskell/exercises/saddle-points/stack.yaml +1 -1
  148. data/tracks/haskell/exercises/say/stack.yaml +1 -1
  149. data/tracks/haskell/exercises/scrabble-score/stack.yaml +1 -1
  150. data/tracks/haskell/exercises/secret-handshake/stack.yaml +1 -1
  151. data/tracks/haskell/exercises/series/stack.yaml +1 -1
  152. data/tracks/haskell/exercises/sgf-parsing/stack.yaml +1 -1
  153. data/tracks/haskell/exercises/sieve/stack.yaml +1 -1
  154. data/tracks/haskell/exercises/simple-cipher/stack.yaml +1 -1
  155. data/tracks/haskell/exercises/simple-linked-list/stack.yaml +1 -1
  156. data/tracks/haskell/exercises/space-age/stack.yaml +1 -1
  157. data/tracks/haskell/exercises/spiral-matrix/stack.yaml +1 -1
  158. data/tracks/haskell/exercises/strain/stack.yaml +1 -1
  159. data/tracks/haskell/exercises/sublist/stack.yaml +1 -1
  160. data/tracks/haskell/exercises/sum-of-multiples/stack.yaml +1 -1
  161. data/tracks/haskell/exercises/triangle/stack.yaml +1 -1
  162. data/tracks/haskell/exercises/trinary/stack.yaml +1 -1
  163. data/tracks/haskell/exercises/twelve-days/stack.yaml +1 -1
  164. data/tracks/haskell/exercises/word-count/stack.yaml +1 -1
  165. data/tracks/haskell/exercises/wordy/stack.yaml +1 -1
  166. data/tracks/haskell/exercises/zebra-puzzle/stack.yaml +1 -1
  167. data/tracks/haskell/exercises/zipper/stack.yaml +1 -1
  168. data/tracks/java/config.json +12 -0
  169. data/tracks/java/exercises/alphametics/.meta/src/reference/java/Alphametics.java +125 -0
  170. data/tracks/java/exercises/alphametics/.meta/src/reference/java/UnsolvablePuzzleException.java +2 -0
  171. data/tracks/java/exercises/alphametics/.meta/src/version +1 -0
  172. data/tracks/java/exercises/alphametics/README.md +47 -0
  173. data/tracks/java/exercises/alphametics/build.gradle +18 -0
  174. data/tracks/java/exercises/alphametics/src/main/java/.keep +0 -0
  175. data/tracks/java/exercises/alphametics/src/main/java/UnsolvablePuzzleException.java +2 -0
  176. data/tracks/java/exercises/alphametics/src/test/java/AlphameticsTest.java +150 -0
  177. data/tracks/java/exercises/beer-song/.meta/src/reference/java/BeerSong.java +5 -4
  178. data/tracks/java/exercises/beer-song/.meta/version +1 -0
  179. data/tracks/java/exercises/beer-song/src/test/java/BeerSongTest.java +24 -16
  180. data/tracks/java/exercises/binary-search/.meta/version +1 -0
  181. data/tracks/java/exercises/book-store/.meta/version +1 -0
  182. data/tracks/java/exercises/book-store/src/test/java/BookStoreTest.java +15 -8
  183. data/tracks/java/exercises/circular-buffer/.meta/version +1 -0
  184. data/tracks/java/exercises/list-ops/.meta/version +1 -1
  185. data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +1 -1
  186. data/tracks/java/exercises/nth-prime/.meta/version +1 -0
  187. data/tracks/java/exercises/settings.gradle +1 -0
  188. data/tracks/java/exercises/tournament/.meta/version +1 -0
  189. data/tracks/java/exercises/transpose/.meta/version +1 -0
  190. data/tracks/java/exercises/transpose/src/test/java/TransposeTest.java +29 -74
  191. data/tracks/java/exercises/wordy/.meta/version +1 -0
  192. data/tracks/javascript/.eslintignore +0 -1
  193. data/tracks/javascript/config.json +13 -3
  194. data/tracks/javascript/exercises/bowling/example.js +24 -10
  195. data/tracks/javascript/exercises/forth/README.md +56 -0
  196. data/tracks/javascript/exercises/forth/example.js +66 -0
  197. data/tracks/javascript/exercises/forth/forth.spec.js +259 -0
  198. data/tracks/lua/config.json +92 -81
  199. data/tracks/lua/exercises/accumulate/README.md +42 -0
  200. data/tracks/lua/exercises/beer-song/README.md +1 -1
  201. data/tracks/lua/exercises/bob/README.md +2 -0
  202. data/tracks/lua/exercises/crypto-square/README.md +6 -4
  203. data/tracks/lua/exercises/house/README.md +1 -1
  204. data/tracks/lua/exercises/isbn-verifier/README.md +25 -20
  205. data/tracks/lua/exercises/kindergarten-garden/README.md +3 -3
  206. data/tracks/lua/exercises/meetup/README.md +16 -12
  207. data/tracks/lua/exercises/nucleotide-count/README.md +2 -2
  208. data/tracks/lua/exercises/phone-number/README.md +1 -1
  209. data/tracks/lua/exercises/pov/README.md +0 -2
  210. data/tracks/lua/exercises/queen-attack/README.md +22 -22
  211. data/tracks/lua/exercises/rectangles/README.md +9 -9
  212. data/tracks/lua/exercises/reverse-string/README.md +23 -0
  213. data/tracks/lua/exercises/reverse-string/example.lua +7 -0
  214. data/tracks/lua/exercises/reverse-string/reverse-string_spec.lua +24 -0
  215. data/tracks/lua/exercises/secret-handshake/README.md +1 -1
  216. data/tracks/lua/exercises/space-age/README.md +1 -2
  217. data/tracks/lua/exercises/sum-of-multiples/README.md +3 -3
  218. data/tracks/perl6/exercises/two-fer/README.md +1 -1
  219. data/tracks/python/exercises/luhn/luhn_test.py +1 -1
  220. metadata +39 -6
@@ -0,0 +1,42 @@
1
+ # Accumulate
2
+
3
+ Implement the `accumulate` operation, which, given a collection and an
4
+ operation to perform on each element of the collection, returns a new
5
+ collection containing the result of applying that operation to each element of
6
+ the input collection.
7
+
8
+ Given the collection of numbers:
9
+
10
+ - 1, 2, 3, 4, 5
11
+
12
+ And the operation:
13
+
14
+ - square a number (`x => x * x`)
15
+
16
+ Your code should be able to produce the collection of squares:
17
+
18
+ - 1, 4, 9, 16, 25
19
+
20
+ Check out the test suite to see the expected function signature.
21
+
22
+ ## Restrictions
23
+
24
+ Keep your hands off that collect/map/fmap/whatchamacallit functionality
25
+ provided by your standard library!
26
+ Solve this one yourself using other basic tools instead.
27
+
28
+ ## Running the tests
29
+
30
+ To run the tests, run the command `busted .` from within the exercise directory.
31
+
32
+ ## Further information
33
+
34
+ For more detailed information about the Lua track, including how to get help if
35
+ you're having trouble, please visit the exercism.io [Lua language page](http://exercism.io/languages/lua/about).
36
+
37
+ ## Source
38
+
39
+ Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2)
40
+
41
+ ## Submitting Incomplete Solutions
42
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -1,6 +1,6 @@
1
1
  # Beer Song
2
2
 
3
- Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
3
+ Recite the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
4
4
 
5
5
  Note that not all verses are identical.
6
6
 
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
6
6
 
7
7
  He answers 'Whoa, chill out!' if you yell at him.
8
8
 
9
+ He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
10
+
9
11
  He says 'Fine. Be that way!' if you address him without actually saying
10
12
  anything.
11
13
 
@@ -45,12 +45,14 @@ The message above is coded as:
45
45
  imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
46
46
  ```
47
47
 
48
- Output the encoded text in chunks. Phrases that fill perfect squares
49
- `(r X r)` should be output in `r`-length chunks separated by spaces.
50
- Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.
48
+ Output the encoded text in chunks. Phrases that fill perfect rectangles
49
+ `(r X c)` should be output `c` chunks of `r` length, separated by spaces.
50
+ Phrases that do not fill perfect rectangles will have `n` empty spaces.
51
+ Those spaces should be distributed evenly, added to the end of the last
52
+ `n` chunks.
51
53
 
52
54
  ```text
53
- imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
55
+ imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
54
56
  ```
55
57
 
56
58
  Notice that were we to stack these, we could visually decode the
@@ -1,6 +1,6 @@
1
1
  # House
2
2
 
3
- Output the nursery rhyme 'This is the House that Jack Built'.
3
+ Recite the nursery rhyme 'This is the House that Jack Built'.
4
4
 
5
5
  > [The] process of placing a phrase of clause within another phrase of
6
6
  > clause is called embedding. It is through the processes of recursion
@@ -1,40 +1,45 @@
1
1
  # Isbn Verifier
2
2
 
3
- Check if a given ISBN-10 is valid.
3
+ The [ISBN-10 verification process](https://en.wikipedia.org/wiki/International_Standard_Book_Number) is used to validate book identification
4
+ numbers. These normally contain dashes and look like: `3-598-21508-8`
4
5
 
5
- ## Functionality
6
+ ## ISBN
6
7
 
7
- Given an unkown string the program should check if the provided string is a valid ISBN-10.
8
- Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
8
+ The ISBN-10 format is 9 digits (0 to 9) plus one check character (either a digit or an X only). In the case the check character is an X, this represents the value '10'. These may be communicated with or without hyphens, and can be checked for their validity by the following formula:
9
9
 
10
- The program should allow for ISBN-10 without the separating dashes to be verified as well.
10
+ ```
11
+ (x1 * 10 + x2 * 9 + x3 * 8 + x4 * 7 + x5 * 6 + x6 * 5 + x7 * 4 + x8 * 3 + x9 * 2 + x10 * 1) mod 11 == 0
12
+ ```
11
13
 
12
- ## ISBN
14
+ If the result is 0, then it is a valid ISBN-10, otherwise it is invalid.
15
+
16
+ ## Example
13
17
 
14
- Let's take a random ISBN-10 number, say `3-598-21508-8` for this.
15
- The first digit block indicates the group where the ISBN belongs. Groups can consist of shared languages, geographic regions or countries. The leading '3' signals this ISBN is from a german speaking country.
16
- The following number block is to identify the publisher. Since this is a three digit publisher number there is a 5 digit title number for this book.
17
- The last digit in the ISBN is the check digit which is used to detect read errors.
18
+ Let's take the ISBN-10 `3-598-21508-8`. We plug it in to the formula, and get:
19
+ ```
20
+ (3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 == 0
21
+ ```
18
22
 
19
- The first 9 digits in the ISBN have to be between 0 and 9.
20
- The check digit can additionally be an 'X' to allow 10 to be a valid check digit as well.
23
+ Since the result is 0, this proves that our ISBN is valid.
24
+
25
+ ## Task
26
+
27
+ Given a string the program should check if the provided string is a valid ISBN-10.
28
+ Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
21
29
 
22
- A valid ISBN-10 is calculated with this formula `(x1 * 10 + x2 * 9 + x3 * 8 + x4 * 7 + x5 * 6 + x6 * 5 + x7 * 4 + x8 * 3 + x9 * 2 + x10 * 1) mod 11 == 0`
23
- So for our example ISBN this means:
24
- (3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 = 0
30
+ The program should be able to verify ISBN-10 both with and without separating dashes.
25
31
 
26
- Which proves that the ISBN is valid.
27
32
 
28
33
  ## Caveats
29
34
 
30
- Converting from string to number can be tricky in certain languages.
31
- It's getting even trickier since the check-digit of an ISBN-10 can be 'X'.
35
+ Converting from strings to numbers can be tricky in certain languages.
36
+ Now, it's even trickier since the check digit of an ISBN-10 may be 'X' (representing '10'). For instance `3-598-21507-X` is a valid ISBN-10.
32
37
 
33
38
  ## Bonus tasks
34
39
 
35
- * Generate a valid ISBN-13 from the input ISBN-10 (and maybe verify it again with a derived verifier)
40
+ * Generate a valid ISBN-13 from the input ISBN-10 (and maybe verify it again with a derived verifier).
36
41
 
37
- * Generate valid ISBN, maybe even from a given starting ISBN
42
+ * Generate valid ISBN, maybe even from a given starting ISBN.
38
43
  ## Running the tests
39
44
 
40
45
  To run the tests, run the command `busted .` from within the exercise directory.
@@ -9,8 +9,8 @@ actual dirt, and grow actual plants.
9
9
 
10
10
  They've chosen to grow grass, clover, radishes, and violets.
11
11
 
12
- To this end, the children have put little cups along the window sills, and
13
- planted one type of plant in each cup, choosing randomly from the available
12
+ To this end, the children have put little cups along the window sills, and
13
+ planted one type of plant in each cup, choosing randomly from the available
14
14
  types of seeds.
15
15
 
16
16
  ```text
@@ -25,7 +25,7 @@ There are 12 children in the class:
25
25
  - Eve, Fred, Ginny, Harriet,
26
26
  - Ileana, Joseph, Kincaid, and Larry.
27
27
 
28
- Each child gets 4 cups, two on each row. Their teacher assigns cups to
28
+ Each child gets 4 cups, two on each row. Their teacher assigns cups to
29
29
  the children alphabetically by their names.
30
30
 
31
31
  The following diagram represents Alice's plants:
@@ -2,25 +2,29 @@
2
2
 
3
3
  Calculate the date of meetups.
4
4
 
5
- Typically meetups happen on the same day of the week. In this exercise, you will take
6
- a description of a meetup date, and return the actual meetup date.
5
+ Typically meetups happen on the same day of the week. In this exercise, you
6
+ will take a description of a meetup date, and return the actual meetup date.
7
7
 
8
8
  Examples of general descriptions are:
9
9
 
10
- - the first Monday of January 2017
11
- - the third Tuesday of January 2017
12
- - the Wednesteenth of January 2017
13
- - the last Thursday of January 2017
10
+ - The first Monday of January 2017
11
+ - The third Tuesday of January 2017
12
+ - The wednesteenth of January 2017
13
+ - The last Thursday of January 2017
14
14
 
15
- Note that "Monteenth", "Tuesteenth", etc are all made up words. There
16
- was a meetup whose members realized that there are exactly 7 numbered days in a month that
17
- end in '-teenth'. Therefore, one is guaranteed that each day of the week
15
+ The descriptors you are expected to parse are:
16
+ first, second, third, fourth, fifth, last, monteenth, tuesteenth, wednesteenth,
17
+ thursteenth, friteenth, saturteenth, sunteenth
18
+
19
+ Note that "monteenth", "tuesteenth", etc are all made up words. There was a
20
+ meetup whose members realized that there are exactly 7 numbered days in a month
21
+ that end in '-teenth'. Therefore, one is guaranteed that each day of the week
18
22
  (Monday, Tuesday, ...) will have exactly one date that is named with '-teenth'
19
23
  in every month.
20
24
 
21
- Given examples of a meetup dates, each containing a month, day, year, and descriptor
22
- (first, second, teenth, etc), calculate the date of the actual meetup.
23
- For example, if given "First Monday of January 2017", the correct meetup date is 2017/1/2
25
+ Given examples of a meetup dates, each containing a month, day, year, and
26
+ descriptor calculate the date of the actual meetup. For example, if given
27
+ "The first Monday of January 2017", the correct meetup date is 2017/1/2.
24
28
 
25
29
  ## Running the tests
26
30
 
@@ -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:
@@ -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`
@@ -2,8 +2,6 @@
2
2
 
3
3
  Reparent a graph on a selected node.
4
4
 
5
- # Tree Reparenting
6
-
7
5
  This exercise is all about re-orientating a graph to see things from a different
8
6
  point of view. For example family trees are usually presented from the
9
7
  ancestor's perspective:
@@ -1,30 +1,30 @@
1
- # Collatz Conjecture
1
+ # Queen Attack
2
2
 
3
- The Collatz Conjecture or 3x+1 problem can be summarized as follows:
3
+ Given the position of two queens on a chess board, indicate whether or not they
4
+ are positioned so that they can attack each other.
4
5
 
5
- Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is
6
- odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely.
7
- The conjecture states that no matter which number you start with, you will
8
- always reach 1 eventually.
6
+ In the game of chess, a queen can attack pieces which are on the same
7
+ row, column, or diagonal.
9
8
 
10
- Given a number n, return the number of steps required to reach 1.
9
+ A chessboard can be represented by an 8 by 8 array.
11
10
 
12
- ## Examples
11
+ So if you're told the white queen is at (2, 3) and the black queen at
12
+ (5, 6), then you'd know you've got a set-up like so:
13
13
 
14
- Starting with n = 12, the steps would be as follows:
14
+ ```text
15
+ _ _ _ _ _ _ _ _
16
+ _ _ _ _ _ _ _ _
17
+ _ _ _ W _ _ _ _
18
+ _ _ _ _ _ _ _ _
19
+ _ _ _ _ _ _ _ _
20
+ _ _ _ _ _ _ B _
21
+ _ _ _ _ _ _ _ _
22
+ _ _ _ _ _ _ _ _
23
+ ```
15
24
 
16
- 0. 12
17
- 1. 6
18
- 2. 3
19
- 3. 10
20
- 4. 5
21
- 5. 16
22
- 6. 8
23
- 7. 4
24
- 8. 2
25
- 9. 1
26
-
27
- Resulting in 9 steps. So for input n = 12, the return value would be 9.
25
+ You'd also be able to answer whether the queens can attack each other.
26
+ In this case, that answer would be yes, they can, because both pieces
27
+ share a diagonal.
28
28
 
29
29
  ## Running the tests
30
30
 
@@ -37,7 +37,7 @@ you're having trouble, please visit the exercism.io [Lua language page](http://e
37
37
 
38
38
  ## Source
39
39
 
40
- An unsolved problem in mathematics named after mathematician Lothar Collatz [https://en.wikipedia.org/wiki/3x_%2B_1_problem](https://en.wikipedia.org/wiki/3x_%2B_1_problem)
40
+ J Dalbey's Programming Practice problems [http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html)
41
41
 
42
42
  ## Submitting Incomplete Solutions
43
43
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -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
@@ -0,0 +1,23 @@
1
+ # reverse-string
2
+
3
+ Reverse a string
4
+
5
+ For example:
6
+ input: "cool"
7
+ output: "looc"
8
+
9
+ ## Running the tests
10
+
11
+ To run the tests, run the command `busted .` from within the exercise directory.
12
+
13
+ ## Further information
14
+
15
+ For more detailed information about the Lua track, including how to get help if
16
+ you're having trouble, please visit the exercism.io [Lua language page](http://exercism.io/languages/lua/about).
17
+
18
+ ## Source
19
+
20
+ Introductory challenge to reverse an input string [https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb](https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb)
21
+
22
+ ## Submitting Incomplete Solutions
23
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,7 @@
1
+ return function(s)
2
+ local reversed = ''
3
+ for c in s:gmatch('.') do
4
+ reversed = c .. reversed
5
+ end
6
+ return reversed
7
+ end
@@ -0,0 +1,24 @@
1
+ local reverse_string = require('reverse-string')
2
+
3
+ describe('reverse-string', function()
4
+ it('an empty string', function()
5
+ assert.are.equal('', reverse_string(''))
6
+ end)
7
+
8
+ it('a word', function()
9
+ assert.are.equal('tobor', reverse_string('robot'))
10
+ end)
11
+
12
+ it('a capitalized word', function()
13
+ assert.are.equal('nemaR', reverse_string('Ramen'))
14
+ end)
15
+
16
+ it('a sentence with punctuation', function()
17
+ assert.are.equal("!yrgnuh m'I", reverse_string("I'm hungry!"))
18
+
19
+ end)
20
+
21
+ it('a palindrome', function()
22
+ assert.are.equal('racecar', reverse_string('racecar'))
23
+ end)
24
+ end)
@@ -39,7 +39,7 @@ you're having trouble, please visit the exercism.io [Lua language page](http://e
39
39
 
40
40
  ## Source
41
41
 
42
- Bert, in Mary Poppins [http://www.imdb.com/character/ch0011238/quotes](http://www.imdb.com/character/ch0011238/quotes)
42
+ Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
43
43
 
44
44
  ## Submitting Incomplete Solutions
45
45
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -12,8 +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.69 Earth-years old. Round all ages to
16
- the nearest hundredth of a year.
15
+ be able to say that they're 31.69 Earth-years old.
17
16
 
18
17
  If you're wondering why Pluto didn't make the cut, go watch [this
19
18
  youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
@@ -1,10 +1,10 @@
1
1
  # Sum Of Multiples
2
2
 
3
- Given a number, find the sum of all the multiples of particular numbers up to
3
+ Given a number, find the sum of all the unique multiples of particular numbers up to
4
4
  but not including that number.
5
5
 
6
- If we list all the natural numbers up to but not including 20 that are
7
- multiples of either 3 or 5, we get 3, 5, 6 and 9, 10, 12, 15, and 18.
6
+ If we list all the natural numbers below 20 that are multiples of 3 or 5,
7
+ we get 3, 5, 6, 9, 10, 12, 15, and 18.
8
8
 
9
9
  The sum of these multiples is 78.
10
10