trackler 2.2.1.102 → 2.2.1.103
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/two-fer/metadata.yml +0 -1
- data/tracks/c/exercises/bob/.meta/description.md +10 -0
- data/tracks/cfml/exercises/acronym/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/anagram/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/atbash-cipher/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/bob/.meta/description.md +10 -0
- data/tracks/cfml/exercises/bob/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/diamond/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/difference-of-squares/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/flatten-array/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/gigasecond/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/grains/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/hamming/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/isogram/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/largest-series-product/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/luhn/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/markdown/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/nth-prime/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/pangram/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/pig-latin/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/raindrops/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/rna-transcription/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/saddle-points/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/scrabble-score/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/secret-handshake/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/space-age/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/sum-of-multiples/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/triangle/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/cfml/exercises/word-count/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/coffeescript/exercises/bob/.meta/description.md +10 -0
- data/tracks/common-lisp/exercises/bob/.meta/description.md +10 -0
- data/tracks/cpp/exercises/bob/.meta/description.md +10 -0
- data/tracks/crystal/exercises/triangle/README.md +52 -0
- data/tracks/csharp/exercises/complex-numbers/README.md +44 -0
- data/tracks/d/exercises/bob/.meta/description.md +10 -0
- data/tracks/dart/exercises/bob/.meta/description.md +10 -0
- data/tracks/dart/exercises/bob/README.md +0 -1
- data/tracks/ecmascript/exercises/bob/.meta/description.md +10 -0
- data/tracks/ecmascript/exercises/bob/README.md +1 -1
- data/tracks/elisp/config/exercise_readme.go.tmpl +0 -3
- data/tracks/elm/exercises/bob/.meta/description.md +10 -0
- data/tracks/elm/exercises/collatz-conjecture/README.md +63 -0
- data/tracks/erlang/exercises/bob/.meta/description.md +10 -0
- data/tracks/erlang/exercises/complex-numbers/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/erlang/exercises/robot-simulator/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/fortran/config/exercise_readme.go.tmpl +0 -3
- data/tracks/fsharp/exercises/clock/ClockTest.fs +9 -9
- data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGardenTest.fs +1 -1
- data/tracks/fsharp/exercises/ocr-numbers/OcrNumbersTest.fs +35 -35
- data/tracks/fsharp/exercises/palindrome-products/PalindromeProductsTest.fs +1 -1
- data/tracks/fsharp/exercises/poker/PokerTest.fs +57 -57
- data/tracks/fsharp/exercises/prime-factors/PrimeFactorsTest.fs +1 -1
- data/tracks/fsharp/exercises/protein-translation/ProteinTranslationTest.fs +1 -1
- data/tracks/fsharp/exercises/proverb/ProverbTest.fs +13 -13
- data/tracks/fsharp/exercises/queen-attack/QueenAttackTest.fs +1 -1
- data/tracks/fsharp/exercises/rail-fence-cipher/RailFenceCipherTest.fs +1 -1
- data/tracks/fsharp/exercises/raindrops/RaindropsTest.fs +1 -1
- data/tracks/fsharp/exercises/rectangles/RectanglesTest.fs +70 -70
- data/tracks/fsharp/exercises/reverse-string/ReverseStringTest.fs +1 -1
- data/tracks/fsharp/exercises/robot-simulator/RobotSimulatorTest.fs +1 -1
- data/tracks/fsharp/exercises/roman-numerals/RomanNumeralsTest.fs +5 -1
- data/tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs +1 -1
- data/tracks/fsharp/exercises/word-count/Example.fs +1 -1
- data/tracks/fsharp/exercises/word-count/WordCount.fs +1 -1
- data/tracks/fsharp/exercises/word-count/WordCountTest.fs +12 -12
- data/tracks/fsharp/generators/Generators.fs +26 -40
- data/tracks/gnu-apl/config/exercise_readme.go.tmpl +0 -3
- data/tracks/go/exercises/armstrong-numbers/README.md +36 -0
- data/tracks/go/exercises/two-bucket/.meta/hints.md +23 -3
- data/tracks/go/exercises/two-bucket/README.md +23 -3
- data/tracks/go/exercises/two-bucket/bonus_test.go +22 -0
- data/tracks/go/exercises/two-bucket/example.go +9 -5
- data/tracks/go/exercises/two-bucket/two_bucket_test.go +31 -27
- data/tracks/haxe/config/exercise_readme.go.tmpl +0 -3
- data/tracks/haxe/exercises/leap/README.md +33 -0
- data/tracks/java/exercises/parallel-letter-frequency/.meta/{HINTS.md → hints.md} +0 -0
- data/tracks/java/exercises/protein-translation/README.md +2 -2
- data/tracks/lfe/exercises/bob/.meta/description.md +10 -0
- data/tracks/nim/config/exercise_readme.go.tmpl +0 -3
- data/tracks/objective-c/exercises/collatz-conjecture/README.md +50 -0
- data/tracks/objective-c/exercises/grains/README.md +50 -0
- data/tracks/objective-c/exercises/nth-prime/README.md +32 -0
- data/tracks/objective-c/exercises/say/README.md +86 -0
- data/tracks/objective-c/exercises/two-fer/README.md +36 -0
- data/tracks/php/exercises/collatz-conjecture/README.md +48 -0
- data/tracks/php/exercises/crypto-square/README.md +91 -0
- data/tracks/php/exercises/flatten-array/README.md +32 -0
- data/tracks/php/exercises/transpose/README.md +80 -0
- data/tracks/plsql/exercises/hello-world/README.md +41 -0
- data/tracks/powershell/config/exercise_readme.go.tmpl +0 -3
- data/tracks/prolog/config/exercise_readme.go.tmpl +0 -3
- data/tracks/python/exercises/bowling/README.md +92 -0
- data/tracks/r/config.json +12 -1
- data/tracks/r/exercises/bob/.meta/description.md +10 -0
- data/tracks/r/exercises/diamond/README.md +69 -0
- data/tracks/r/exercises/diamond/diamond.R +3 -0
- data/tracks/r/exercises/diamond/example.R +15 -0
- data/tracks/r/exercises/diamond/test_diamond.R +90 -0
- data/tracks/scala/exercises/bob/.meta/description.md +10 -0
- data/tracks/sml/exercises/bob/.meta/description.md +10 -0
- data/tracks/swift/exercises/rotational-cipher/README.md +45 -0
- data/tracks/typescript/exercises/bob/.meta/description.md +10 -0
- data/tracks/vbnet/exercises/bob/.meta/description.md +10 -0
- data/tracks/vimscript/exercises/bob/.meta/description.md +10 -0
- metadata +70 -38
- data/tracks/elisp/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/fortran/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/gnu-apl/config/exercise-readme-insert.md +0 -0
- data/tracks/haxe/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/nim/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/powershell/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/prolog/docs/EXERCISE_README_INSERT.md +0 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
# Say
|
2
|
+
|
3
|
+
Given a number from 0 to 999,999,999,999, spell out that number in English.
|
4
|
+
|
5
|
+
## Step 1
|
6
|
+
|
7
|
+
Handle the basic case of 0 through 99.
|
8
|
+
|
9
|
+
If the input to the program is `22`, then the output should be
|
10
|
+
`'twenty-two'`.
|
11
|
+
|
12
|
+
Your program should complain loudly if given a number outside the
|
13
|
+
blessed range.
|
14
|
+
|
15
|
+
Some good test cases for this program are:
|
16
|
+
|
17
|
+
- 0
|
18
|
+
- 14
|
19
|
+
- 50
|
20
|
+
- 98
|
21
|
+
- -1
|
22
|
+
- 100
|
23
|
+
|
24
|
+
### Extension
|
25
|
+
|
26
|
+
If you're on a Mac, shell out to Mac OS X's `say` program to talk out
|
27
|
+
loud.
|
28
|
+
|
29
|
+
## Step 2
|
30
|
+
|
31
|
+
Implement breaking a number up into chunks of thousands.
|
32
|
+
|
33
|
+
So `1234567890` should yield a list like 1, 234, 567, and 890, while the
|
34
|
+
far simpler `1000` should yield just 1 and 0.
|
35
|
+
|
36
|
+
The program must also report any values that are out of range.
|
37
|
+
|
38
|
+
## Step 3
|
39
|
+
|
40
|
+
Now handle inserting the appropriate scale word between those chunks.
|
41
|
+
|
42
|
+
So `1234567890` should yield `'1 billion 234 million 567 thousand 890'`
|
43
|
+
|
44
|
+
The program must also report any values that are out of range. It's
|
45
|
+
fine to stop at "trillion".
|
46
|
+
|
47
|
+
## Step 4
|
48
|
+
|
49
|
+
Put it all together to get nothing but plain English.
|
50
|
+
|
51
|
+
`12345` should give `twelve thousand three hundred forty-five`.
|
52
|
+
|
53
|
+
The program must also report any values that are out of range.
|
54
|
+
|
55
|
+
### Extensions
|
56
|
+
|
57
|
+
Use _and_ (correctly) when spelling out the number in English:
|
58
|
+
|
59
|
+
- 14 becomes "fourteen".
|
60
|
+
- 100 becomes "one hundred".
|
61
|
+
- 120 becomes "one hundred and twenty".
|
62
|
+
- 1002 becomes "one thousand and two".
|
63
|
+
- 1323 becomes "one thousand three hundred and twenty-three".
|
64
|
+
|
65
|
+
## Setup
|
66
|
+
|
67
|
+
There are two different methods of getting set up to run the tests with Objective-C:
|
68
|
+
|
69
|
+
- Create an Xcode project with a test target which will run the tests.
|
70
|
+
- Use the ruby gem `objc` as a test runner utility.
|
71
|
+
|
72
|
+
Both are described in more detail here: http://exercism.io/languages/objective-c
|
73
|
+
|
74
|
+
|
75
|
+
### Submitting Exercises
|
76
|
+
|
77
|
+
When submitting an exercise, make sure your solution file is in the same directory as the test code.
|
78
|
+
|
79
|
+
For example, if you're submitting `Bob.m` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/objective-c/bob/Bob.m`.
|
80
|
+
|
81
|
+
## Source
|
82
|
+
|
83
|
+
A variation on JavaRanch CattleDrive, exercise 4a [http://www.javaranch.com/say.jsp](http://www.javaranch.com/say.jsp)
|
84
|
+
|
85
|
+
## Submitting Incomplete Solutions
|
86
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Two Fer
|
2
|
+
|
3
|
+
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
4
|
+
|
5
|
+
```text
|
6
|
+
"One for X, one for me."
|
7
|
+
```
|
8
|
+
|
9
|
+
When X is a name or "you".
|
10
|
+
|
11
|
+
If the given name is "Alice", the result should be "One for Alice, one for me."
|
12
|
+
If no name is given, the result should be "One for you, one for me."
|
13
|
+
|
14
|
+
|
15
|
+
## Setup
|
16
|
+
|
17
|
+
There are two different methods of getting set up to run the tests with Objective-C:
|
18
|
+
|
19
|
+
- Create an Xcode project with a test target which will run the tests.
|
20
|
+
- Use the ruby gem `objc` as a test runner utility.
|
21
|
+
|
22
|
+
Both are described in more detail here: http://exercism.io/languages/objective-c
|
23
|
+
|
24
|
+
|
25
|
+
### Submitting Exercises
|
26
|
+
|
27
|
+
When submitting an exercise, make sure your solution file is in the same directory as the test code.
|
28
|
+
|
29
|
+
For example, if you're submitting `Bob.m` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/objective-c/bob/Bob.m`.
|
30
|
+
|
31
|
+
## Source
|
32
|
+
|
33
|
+
[https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
|
34
|
+
|
35
|
+
## Submitting Incomplete Solutions
|
36
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Collatz Conjecture
|
2
|
+
|
3
|
+
The Collatz Conjecture or 3x+1 problem can be summarized as follows:
|
4
|
+
|
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.
|
9
|
+
|
10
|
+
Given a number n, return the number of steps required to reach 1.
|
11
|
+
|
12
|
+
## Examples
|
13
|
+
|
14
|
+
Starting with n = 12, the steps would be as follows:
|
15
|
+
|
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.
|
28
|
+
|
29
|
+
## Making the Test Suite Pass
|
30
|
+
|
31
|
+
1. Get [PHPUnit].
|
32
|
+
|
33
|
+
% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
|
34
|
+
% chmod +x phpunit.phar
|
35
|
+
|
36
|
+
2. Execute the tests for an assignment.
|
37
|
+
|
38
|
+
% phpunit.phar wordy/wordy_test.php
|
39
|
+
|
40
|
+
[PHPUnit]: http://phpunit.de
|
41
|
+
|
42
|
+
|
43
|
+
## Source
|
44
|
+
|
45
|
+
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)
|
46
|
+
|
47
|
+
## Submitting Incomplete Solutions
|
48
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Crypto Square
|
2
|
+
|
3
|
+
Implement the classic method for composing secret messages called a square code.
|
4
|
+
|
5
|
+
Given an English text, output the encoded version of that text.
|
6
|
+
|
7
|
+
First, the input is normalized: the spaces and punctuation are removed
|
8
|
+
from the English text and the message is downcased.
|
9
|
+
|
10
|
+
Then, the normalized characters are broken into rows. These rows can be
|
11
|
+
regarded as forming a rectangle when printed with intervening newlines.
|
12
|
+
|
13
|
+
For example, the sentence
|
14
|
+
|
15
|
+
> If man was meant to stay on the ground, god would have given us roots.
|
16
|
+
|
17
|
+
is normalized to:
|
18
|
+
|
19
|
+
> ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots
|
20
|
+
|
21
|
+
The plaintext should be organized in to a rectangle. The size of the
|
22
|
+
rectangle (`r x c`) should be decided by the length of the message,
|
23
|
+
such that `c >= r` and `c - r <= 1`, where `c` is the number of columns
|
24
|
+
and `r` is the number of rows.
|
25
|
+
|
26
|
+
Our normalized text is 54 characters long, dictating a rectangle with
|
27
|
+
`c = 8` and `r = 7`:
|
28
|
+
|
29
|
+
```text
|
30
|
+
ifmanwas
|
31
|
+
meanttos
|
32
|
+
tayonthe
|
33
|
+
groundgo
|
34
|
+
dwouldha
|
35
|
+
vegivenu
|
36
|
+
sroots
|
37
|
+
```
|
38
|
+
|
39
|
+
The coded message is obtained by reading down the columns going left to
|
40
|
+
right.
|
41
|
+
|
42
|
+
The message above is coded as:
|
43
|
+
|
44
|
+
```text
|
45
|
+
imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
|
46
|
+
```
|
47
|
+
|
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.
|
53
|
+
|
54
|
+
```text
|
55
|
+
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
|
56
|
+
```
|
57
|
+
|
58
|
+
Notice that were we to stack these, we could visually decode the
|
59
|
+
cyphertext back in to the original message:
|
60
|
+
|
61
|
+
```text
|
62
|
+
imtgdvs
|
63
|
+
fearwer
|
64
|
+
mayoogo
|
65
|
+
anouuio
|
66
|
+
ntnnlvt
|
67
|
+
wttddes
|
68
|
+
aohghn
|
69
|
+
sseoau
|
70
|
+
```
|
71
|
+
|
72
|
+
## Making the Test Suite Pass
|
73
|
+
|
74
|
+
1. Get [PHPUnit].
|
75
|
+
|
76
|
+
% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
|
77
|
+
% chmod +x phpunit.phar
|
78
|
+
|
79
|
+
2. Execute the tests for an assignment.
|
80
|
+
|
81
|
+
% phpunit.phar wordy/wordy_test.php
|
82
|
+
|
83
|
+
[PHPUnit]: http://phpunit.de
|
84
|
+
|
85
|
+
|
86
|
+
## Source
|
87
|
+
|
88
|
+
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)
|
89
|
+
|
90
|
+
## Submitting Incomplete Solutions
|
91
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Flatten Array
|
2
|
+
|
3
|
+
Take a nested list and return a single flattened list with all values except nil/null.
|
4
|
+
|
5
|
+
The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
|
6
|
+
|
7
|
+
For Example
|
8
|
+
|
9
|
+
input: [1,[2,3,null,4],[null],5]
|
10
|
+
|
11
|
+
output: [1,2,3,4,5]
|
12
|
+
|
13
|
+
## Making the Test Suite Pass
|
14
|
+
|
15
|
+
1. Get [PHPUnit].
|
16
|
+
|
17
|
+
% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
|
18
|
+
% chmod +x phpunit.phar
|
19
|
+
|
20
|
+
2. Execute the tests for an assignment.
|
21
|
+
|
22
|
+
% phpunit.phar wordy/wordy_test.php
|
23
|
+
|
24
|
+
[PHPUnit]: http://phpunit.de
|
25
|
+
|
26
|
+
|
27
|
+
## Source
|
28
|
+
|
29
|
+
Interview Question [https://reference.wolfram.com/language/ref/Flatten.html](https://reference.wolfram.com/language/ref/Flatten.html)
|
30
|
+
|
31
|
+
## Submitting Incomplete Solutions
|
32
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Transpose
|
2
|
+
|
3
|
+
Given an input text output it transposed.
|
4
|
+
|
5
|
+
Roughly explained, the transpose of a matrix:
|
6
|
+
|
7
|
+
```text
|
8
|
+
ABC
|
9
|
+
DEF
|
10
|
+
```
|
11
|
+
|
12
|
+
is given by:
|
13
|
+
|
14
|
+
```text
|
15
|
+
AD
|
16
|
+
BE
|
17
|
+
CF
|
18
|
+
```
|
19
|
+
|
20
|
+
Rows become columns and columns become rows. See <https://en.wikipedia.org/wiki/Transpose>.
|
21
|
+
|
22
|
+
If the input has rows of different lengths, this is to be solved as follows:
|
23
|
+
|
24
|
+
- Pad to the left with spaces.
|
25
|
+
- Don't pad to the right.
|
26
|
+
|
27
|
+
Therefore, transposing this matrix:
|
28
|
+
|
29
|
+
```text
|
30
|
+
ABC
|
31
|
+
DE
|
32
|
+
```
|
33
|
+
|
34
|
+
results in:
|
35
|
+
|
36
|
+
```text
|
37
|
+
AD
|
38
|
+
BE
|
39
|
+
C
|
40
|
+
```
|
41
|
+
|
42
|
+
And transposing:
|
43
|
+
|
44
|
+
```text
|
45
|
+
AB
|
46
|
+
DEF
|
47
|
+
```
|
48
|
+
|
49
|
+
results in:
|
50
|
+
|
51
|
+
```text
|
52
|
+
AD
|
53
|
+
BE
|
54
|
+
F
|
55
|
+
```
|
56
|
+
|
57
|
+
In general, all characters from the input should also be present in the transposed output.
|
58
|
+
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).
|
60
|
+
|
61
|
+
## Making the Test Suite Pass
|
62
|
+
|
63
|
+
1. Get [PHPUnit].
|
64
|
+
|
65
|
+
% wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
|
66
|
+
% chmod +x phpunit.phar
|
67
|
+
|
68
|
+
2. Execute the tests for an assignment.
|
69
|
+
|
70
|
+
% phpunit.phar wordy/wordy_test.php
|
71
|
+
|
72
|
+
[PHPUnit]: http://phpunit.de
|
73
|
+
|
74
|
+
|
75
|
+
## Source
|
76
|
+
|
77
|
+
Reddit r/dailyprogrammer challenge #270 [Easy]. [https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text](https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text)
|
78
|
+
|
79
|
+
## Submitting Incomplete Solutions
|
80
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Hello World
|
2
|
+
|
3
|
+
The classical introductory exercise. Just say "Hello, World!".
|
4
|
+
|
5
|
+
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
|
6
|
+
the traditional first program for beginning programming in a new language
|
7
|
+
or environment.
|
8
|
+
|
9
|
+
The objectives are simple:
|
10
|
+
|
11
|
+
- Write a function that returns the string "Hello, World!".
|
12
|
+
- Run the test suite and make sure that it succeeds.
|
13
|
+
- Submit your solution and check it at the website.
|
14
|
+
|
15
|
+
If everything goes well, you will be ready to fetch your first real exercise.
|
16
|
+
|
17
|
+
## Setup
|
18
|
+
|
19
|
+
Go through the setup instructions for PL/SQL to get ready to code:
|
20
|
+
|
21
|
+
http://exercism.io/languages/plsql
|
22
|
+
|
23
|
+
## Running the Tests
|
24
|
+
|
25
|
+
Execute the tests by calling the `run` method in the respective `ut_<exercise>#` package.
|
26
|
+
The necessary code should be contained at the end of the test package.
|
27
|
+
As an example, the test for the _hamming_ exercise would be run using
|
28
|
+
|
29
|
+
```
|
30
|
+
begin
|
31
|
+
ut_hamming#.run;
|
32
|
+
end;
|
33
|
+
/
|
34
|
+
```
|
35
|
+
|
36
|
+
## Source
|
37
|
+
|
38
|
+
This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
|
39
|
+
|
40
|
+
## Submitting Incomplete Solutions
|
41
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Bowling
|
2
|
+
|
3
|
+
Score a bowling game.
|
4
|
+
|
5
|
+
Bowling is a game where players roll a heavy ball to knock down pins
|
6
|
+
arranged in a triangle. Write code to keep track of the score
|
7
|
+
of a game of bowling.
|
8
|
+
|
9
|
+
## Scoring Bowling
|
10
|
+
|
11
|
+
The game consists of 10 frames. A frame is composed of one or two ball
|
12
|
+
throws with 10 pins standing at frame initialization. There are three
|
13
|
+
cases for the tabulation of a frame.
|
14
|
+
|
15
|
+
* An open frame is where a score of less than 10 is recorded for the
|
16
|
+
frame. In this case the score for the frame is the number of pins
|
17
|
+
knocked down.
|
18
|
+
|
19
|
+
* A spare is where all ten pins are knocked down by the second
|
20
|
+
throw. The total value of a spare is 10 plus the number of pins
|
21
|
+
knocked down in their next throw.
|
22
|
+
|
23
|
+
* A strike is where all ten pins are knocked down by the first
|
24
|
+
throw. The total value of a strike is 10 plus the number of pins
|
25
|
+
knocked down in the next two throws. If a strike is immediately
|
26
|
+
followed by a second strike, then the value of the first strike
|
27
|
+
cannot be determined until the ball is thrown one more time.
|
28
|
+
|
29
|
+
Here is a three frame example:
|
30
|
+
|
31
|
+
| Frame 1 | Frame 2 | Frame 3 |
|
32
|
+
| :-------------: |:-------------:| :---------------------:|
|
33
|
+
| X (strike) | 5/ (spare) | 9 0 (open frame) |
|
34
|
+
|
35
|
+
Frame 1 is (10 + 5 + 5) = 20
|
36
|
+
|
37
|
+
Frame 2 is (5 + 5 + 9) = 19
|
38
|
+
|
39
|
+
Frame 3 is (9 + 0) = 9
|
40
|
+
|
41
|
+
This means the current running total is 48.
|
42
|
+
|
43
|
+
The tenth frame in the game is a special case. If someone throws a
|
44
|
+
strike or a spare then they get a fill ball. Fill balls exist to
|
45
|
+
calculate the total of the 10th frame. Scoring a strike or spare on
|
46
|
+
the fill ball does not give the player more fill balls. The total
|
47
|
+
value of the 10th frame is the total number of pins knocked down.
|
48
|
+
|
49
|
+
For a tenth frame of X1/ (strike and a spare), the total value is 20.
|
50
|
+
|
51
|
+
For a tenth frame of XXX (three strikes), the total value is 30.
|
52
|
+
|
53
|
+
## Requirements
|
54
|
+
|
55
|
+
Write code to keep track of the score of a game of bowling. It should
|
56
|
+
support two operations:
|
57
|
+
|
58
|
+
* `roll(pins : int)` is called each time the player rolls a ball. The
|
59
|
+
argument is the number of pins knocked down.
|
60
|
+
* `score() : int` is called only at the very end of the game. It
|
61
|
+
returns the total score for that game.
|
62
|
+
|
63
|
+
## Exception messages
|
64
|
+
|
65
|
+
Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
|
66
|
+
indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
|
67
|
+
every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
|
68
|
+
a message.
|
69
|
+
|
70
|
+
To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
|
71
|
+
`raise Exception`, you shold write:
|
72
|
+
|
73
|
+
```python
|
74
|
+
raise Exception("Meaningful message indicating the source of the error")
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
## Submitting Exercises
|
79
|
+
|
80
|
+
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
81
|
+
|
82
|
+
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
|
83
|
+
|
84
|
+
For more detailed information about running tests, code style and linting,
|
85
|
+
please see the [help page](http://exercism.io/languages/python).
|
86
|
+
|
87
|
+
## Source
|
88
|
+
|
89
|
+
The Bowling Game Kata at but UncleBob [http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata](http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata)
|
90
|
+
|
91
|
+
## Submitting Incomplete Solutions
|
92
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|