trackler 2.2.1.60 → 2.2.1.61
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/beer-song/canonical-data.json +366 -31
- data/problem-specifications/exercises/beer-song/description.md +1 -1
- data/problem-specifications/exercises/pascals-triangle/canonical-data.json +19 -1
- data/problem-specifications/exercises/proverb/canonical-data.json +91 -0
- data/problem-specifications/exercises/proverb/description.md +5 -3
- data/tracks/c/README.md +0 -10
- data/tracks/c/config/maintainers.json +45 -0
- data/tracks/c/config.json +1 -2
- data/tracks/c/docs/TESTS.md +43 -44
- data/tracks/d/docs/INSTALLATION.md +1 -1
- data/tracks/delphi/exercises/beer-song/README.md +1 -1
- data/tracks/delphi/exercises/beer-song/inputdata.txt +3 -1
- data/tracks/delphi/exercises/beer-song/uBeerSongExample.pas +14 -5
- data/tracks/delphi/exercises/beer-song/uBeerSongTests.pas +58 -42
- data/tracks/delphi/exercises/nucleotide-count/README.md +2 -2
- data/tracks/ecmascript/config.json +14 -0
- data/tracks/ecmascript/exercises/house/README.md +146 -0
- data/tracks/ecmascript/exercises/house/example.js +62 -0
- data/tracks/ecmascript/exercises/house/house.spec.js +292 -0
- data/tracks/ecmascript/exercises/house/package.json +71 -0
- data/tracks/go/exercises/allergies/example.go +3 -2
- data/tracks/go/exercises/custom-set/cases_test.go +7 -2
- data/tracks/go/exercises/isogram/.meta/gen.go +55 -0
- data/tracks/go/exercises/isogram/cases_test.go +57 -0
- data/tracks/go/exercises/isogram/isogram_test.go +4 -20
- data/tracks/java/config.json +7 -1
- data/tracks/java/exercises/luhn/src/test/java/LuhnValidatorTest.java +6 -1
- data/tracks/javascript/.eslintignore +0 -3
- data/tracks/javascript/exercises/acronym/example.js +2 -1
- data/tracks/javascript/exercises/diamond/diamond.spec.js +3 -3
- data/tracks/javascript/exercises/diamond/example.js +2 -2
- data/tracks/javascript/exercises/sum-of-multiples/sum-of-multiples.spec.js +9 -9
- data/tracks/python/config.json +33 -11
- data/tracks/python/exercises/dominoes/README.md +28 -0
- data/tracks/python/exercises/dominoes/dominoes.py +2 -0
- data/tracks/python/exercises/dominoes/dominoes_test.py +114 -0
- data/tracks/python/exercises/dominoes/example.py +30 -0
- data/tracks/python/exercises/grains/grains_test.py +5 -7
- data/tracks/python/exercises/phone-number/example.py +7 -13
- data/tracks/python/exercises/phone-number/phone_number_test.py +15 -15
- data/tracks/python/exercises/poker/poker_test.py +93 -52
- data/tracks/python/exercises/react/README.md +30 -0
- data/tracks/python/exercises/react/example.py +65 -0
- data/tracks/python/exercises/react/react.py +17 -0
- data/tracks/python/exercises/react/react_test.py +136 -0
- data/tracks/rust/exercises/pascals-triangle/Cargo.toml +1 -1
- data/tracks/rust/exercises/pascals-triangle/tests/pascals-triangle.rs +56 -0
- data/tracks/swift/Package.swift +1 -1
- data/tracks/swift/config.json +11 -0
- data/tracks/swift/exercises/atbash-cipher/Sources/AtbashExample.swift +1 -1
- data/tracks/swift/exercises/bracket-push/Sources/BracketPushExample.swift +1 -1
- data/tracks/swift/exercises/collatz-conjecture/Package.swift +5 -0
- data/tracks/swift/exercises/collatz-conjecture/README.md +41 -0
- data/tracks/swift/exercises/collatz-conjecture/Sources/CollatzConjecture.swift +1 -0
- data/tracks/swift/exercises/collatz-conjecture/Sources/CollatzConjectureExample.swift +27 -0
- data/tracks/swift/exercises/collatz-conjecture/Tests/CollatzConjectureTests/CollatzConjectureTests.swift +40 -0
- data/tracks/swift/exercises/collatz-conjecture/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/dominoes/Sources/DominoesExample.swift +3 -3
- data/tracks/swift/exercises/grains/Tests/GrainsTests/GrainsTests.swift +3 -3
- data/tracks/swift/exercises/kindergarten-garden/Sources/KindergartenGardenExample.swift +2 -2
- data/tracks/swift/exercises/meetup/Sources/MeetupExample.swift +1 -1
- data/tracks/swift/exercises/nucleotide-count/Sources/NucleotideCountExample.swift +2 -2
- data/tracks/swift/exercises/poker/Sources/PokerExample.swift +137 -131
- data/tracks/swift/exercises/rna-transcription/Sources/RnaTranscriptionExample.swift +2 -2
- data/tracks/swift/exercises/rotational-cipher/Sources/RotationalCipherExample.swift +12 -12
- metadata +24 -2
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"maintainers": [
|
3
|
+
{
|
4
|
+
"github_username": "ryanplusplus",
|
5
|
+
"show_on_website": false,
|
6
|
+
"alumnus": false,
|
7
|
+
"name": null,
|
8
|
+
"bio": null,
|
9
|
+
"link_text": null,
|
10
|
+
"link_url": null,
|
11
|
+
"avatar_url": null
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"github_username": "patricksjackson",
|
15
|
+
"show_on_website": false,
|
16
|
+
"alumnus": false,
|
17
|
+
"name": null,
|
18
|
+
"bio": null,
|
19
|
+
"link_text": null,
|
20
|
+
"link_url": null,
|
21
|
+
"avatar_url": null
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"github_username": "RealBarretBrown",
|
25
|
+
"show_on_website": false,
|
26
|
+
"alumnus": false,
|
27
|
+
"name": null,
|
28
|
+
"bio": null,
|
29
|
+
"link_text": null,
|
30
|
+
"link_url": null,
|
31
|
+
"avatar_url": null
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"github_username": "wolf99",
|
35
|
+
"show_on_website": false,
|
36
|
+
"alumnus": false,
|
37
|
+
"name": "Toby",
|
38
|
+
"bio": null,
|
39
|
+
"link_text": "My GitHub Profile",
|
40
|
+
"link_url": "https://github.com/wolf99",
|
41
|
+
"avatar_url": null
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"docs_url": "https://github.com/exercism/docs/blob/master/maintaining-a-track/maintainer-configuration.md"
|
45
|
+
}
|
data/tracks/c/config.json
CHANGED
data/tracks/c/docs/TESTS.md
CHANGED
@@ -1,62 +1,61 @@
|
|
1
|
-
Each exercise supplies the unit tests and a Make build recipe.
|
2
|
-
provide the implementation.
|
1
|
+
Each exercise supplies the unit tests and a Make build recipe.
|
2
|
+
You provide the implementation.
|
3
3
|
|
4
|
-
Each test file is meant to link against your implementation to provide a
|
5
|
-
|
6
|
-
prints messages for each failing test and reports a non-zero exit status
|
7
|
-
when tests fail.
|
4
|
+
Each test file is meant to link against your implementation to provide a console executable that runs the tests.
|
5
|
+
Running the test executable prints messages for each failing test and reports a non-zero exit status when tests fail.
|
8
6
|
|
9
|
-
|
10
|
-
*
|
7
|
+
To work through an exercise:
|
8
|
+
* Create the initial build with Make
|
11
9
|
* For each unit test:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
* Uncomment the next test
|
10
|
+
* Remove the `TEST_IGNORE()` line.
|
11
|
+
* Satisfy any compile errors to make the test fail.
|
12
|
+
* Implement just enough to make the test pass.
|
13
|
+
* Refactor your implementation to enhance readability, reduce duplication, etc.
|
17
14
|
|
15
|
+
## Compiling and running the tests
|
18
16
|
|
19
|
-
|
17
|
+
Each exercise will bring a `makefile` file along with the unit tests in the `tests/` directory.
|
18
|
+
You should not need to edit the Make file.
|
19
|
+
The provided recipe assumes that your implementation exists as a header file and a source file named after the exercise.
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
and a source file named after the exercise.
|
21
|
+
For instance, the exercise `bob` expects an implementation in `src/bob.h` and `src/bob.c`.
|
22
|
+
For exercises with dashes in their name, the source files are assumed to use underscores, so `word-count` expects `src/word_count.h` and `src/word_count.c`.
|
23
|
+
You may decide that your implementation is sufficiently simple that it can live entirely in the header, in which case you can omit the `c` file.
|
25
24
|
|
26
|
-
|
27
|
-
and `src/bob.c
|
28
|
-
files
|
29
|
-
`src/word_count.h` and `src/word_count.c`. You may decide that your
|
30
|
-
impementation is sufficiently simple that it can live entirely in the
|
31
|
-
header, in which case you can omit the `c` file.
|
25
|
+
**Create your initial implementation files before running Make.**
|
26
|
+
If you do not have files `src/bob.h` and `src/bob.c` when running Make for exercise `bob`, then Make will generate an error about files not being found.
|
27
|
+
**These files can be empty, but they must exist.**
|
32
28
|
|
33
|
-
|
34
|
-
you do not have files `src/bob.h` and `src/bob.c` when running
|
35
|
-
Make for exercise `bob`, then Make will generate an error about files
|
36
|
-
not being found. **These files can be empty, but they must exist.**
|
29
|
+
### Build your code
|
37
30
|
|
38
|
-
|
31
|
+
The simplest way to build your code is by using `make` at the command line (CLI).
|
32
|
+
On Linux the CLI is available in bash or similar, on MacOS use Terminal.
|
33
|
+
On Windows 10, the Windows Subsystem for Linux (WSL) Bash is available.
|
34
|
+
To do this, assuming the current exercise is `bob` and we're in the exercise folder:
|
39
35
|
|
40
|
-
|
41
|
-
* Windows with Visual Studio 2013: Select Build / Build Solution from the menu.
|
42
|
-
* MacOS with Xcode: Select Build from the toolbar
|
43
|
-
|
44
|
-
|
45
|
-
#### Testing on Linux or MacOS with make
|
46
|
-
|
47
|
-
Assuming the current exercise is `bob` and we're in the exercise folder:
|
48
|
-
|
49
|
-
```
|
36
|
+
```bash
|
50
37
|
$ touch src/bob.{h,c}
|
51
|
-
$ make
|
38
|
+
$ make
|
52
39
|
```
|
53
40
|
|
41
|
+
Then to test:
|
54
42
|
|
55
|
-
|
43
|
+
```bash
|
44
|
+
$ make test
|
45
|
+
```
|
56
46
|
|
57
|
-
|
47
|
+
#### MacOS Build Alternative
|
48
|
+
On MacOS you can also use Xcode.
|
49
|
+
To build the code select _Build_ from the toolbar.
|
58
50
|
|
51
|
+
#### Windows Build Alternatives
|
52
|
+
On Microsoft Windows 10 the recommended option, as above, is [WSL Bash](https://msdn.microsoft.com/en-us/commandline/wsl/about).
|
53
|
+
If you are using an earlier version of Windows or WSL Bash is not available to you you can use Microsoft's [Visual Studio](https://www.visualstudio.com/vs/) IDE, which comes with its own compiler.
|
54
|
+
Alternatively you could use [MSYS/MinGW](http://www.mingw.org/) (32-bit only) or [mingw6-w64](http://mingw-w64.org/doku.php) (32 & 64-bit).
|
59
55
|
|
60
|
-
|
56
|
+
If using Visual Studio, the easiest way to open an exercise is to start a "Blank Project" from the C project template types.
|
57
|
+
Then manually add the files from the exercise to it by right clicking on the project in the Solution Explorer and selecting _Add_ > _Existing File_ and selecting each of the .c and .h files within the exercise directory.
|
58
|
+
This allows you to build the project by selecting _Build_ > _Build Solution_ from the menu. Then select _Debug_ > _Start Debugging_ to run it.
|
61
59
|
|
62
|
-
|
60
|
+
Visual Studio can also be made to build the project using the makefile.
|
61
|
+
This requires a per exercise configuration. See the documentation on this [here](https://docs.microsoft.com/en-gb/cpp/ide/non-msbuild-projects).
|
@@ -66,7 +66,7 @@ The [DUB website's download page](https://code.dlang.org/download) has a Windows
|
|
66
66
|
#### Mac OS X
|
67
67
|
|
68
68
|
* The [DUB website's download page](https://code.dlang.org/download) has OS X binaries.
|
69
|
-
* or using [Homebrew](http://brew.sh/): brew install
|
69
|
+
* or using [Homebrew](http://brew.sh/): brew install dub
|
70
70
|
|
71
71
|
#### Linux
|
72
72
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n
|
2
2
|
44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n
|
3
3
|
2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n
|
4
|
+
3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n
|
4
5
|
1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n
|
5
6
|
No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n
|
6
|
-
|
7
|
+
2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n
|
8
|
+
99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n
|
7
9
|
99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n\n97 bottles of beer on the wall, 97 bottles of beer.\nTake one down and pass it around, 96 bottles of beer on the wall.\n\n96 bottles of beer on the wall, 96 bottles of beer.\nTake one down and pass it around, 95 bottles of beer on the wall.\n\n95 bottles of beer on the wall, 95 bottles of beer.\nTake one down and pass it around, 94 bottles of beer on the wall.\n\n94 bottles of beer on the wall, 94 bottles of beer.\nTake one down and pass it around, 93 bottles of beer on the wall.\n\n93 bottles of beer on the wall, 93 bottles of beer.\nTake one down and pass it around, 92 bottles of beer on the wall.\n\n92 bottles of beer on the wall, 92 bottles of beer.\nTake one down and pass it around, 91 bottles of beer on the wall.\n\n91 bottles of beer on the wall, 91 bottles of beer.\nTake one down and pass it around, 90 bottles of beer on the wall.\n\n90 bottles of beer on the wall, 90 bottles of beer.\nTake one down and pass it around, 89 bottles of beer on the wall.\n\n89 bottles of beer on the wall, 89 bottles of beer.\nTake one down and pass it around, 88 bottles of beer on the wall.\n\n88 bottles of beer on the wall, 88 bottles of beer.\nTake one down and pass it around, 87 bottles of beer on the wall.\n\n87 bottles of beer on the wall, 87 bottles of beer.\nTake one down and pass it around, 86 bottles of beer on the wall.\n\n86 bottles of beer on the wall, 86 bottles of beer.\nTake one down and pass it around, 85 bottles of beer on the wall.\n\n85 bottles of beer on the wall, 85 bottles of beer.\nTake one down and pass it around, 84 bottles of beer on the wall.\n\n84 bottles of beer on the wall, 84 bottles of beer.\nTake one down and pass it around, 83 bottles of beer on the wall.\n\n83 bottles of beer on the wall, 83 bottles of beer.\nTake one down and pass it around, 82 bottles of beer on the wall.\n\n82 bottles of beer on the wall, 82 bottles of beer.\nTake one down and pass it around, 81 bottles of beer on the wall.\n\n81 bottles of beer on the wall, 81 bottles of beer.\nTake one down and pass it around, 80 bottles of beer on the wall.\n\n80 bottles of beer on the wall, 80 bottles of beer.\nTake one down and pass it around, 79 bottles of beer on the wall.\n\n79 bottles of beer on the wall, 79 bottles of beer.\nTake one down and pass it around, 78 bottles of beer on the wall.\n\n78 bottles of beer on the wall, 78 bottles of beer.\nTake one down and pass it around, 77 bottles of beer on the wall.\n\n77 bottles of beer on the wall, 77 bottles of beer.\nTake one down and pass it around, 76 bottles of beer on the wall.\n\n76 bottles of beer on the wall, 76 bottles of beer.\nTake one down and pass it around, 75 bottles of beer on the wall.\n\n75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n
|
@@ -4,9 +4,10 @@ interface
|
|
4
4
|
|
5
5
|
type
|
6
6
|
Beer = class
|
7
|
-
|
7
|
+
private
|
8
8
|
class function Verse(number: integer): string; static;
|
9
|
-
|
9
|
+
public
|
10
|
+
class function Recite(start, takeDown: integer): string; static;
|
10
11
|
end;
|
11
12
|
|
12
13
|
implementation
|
@@ -31,15 +32,23 @@ begin
|
|
31
32
|
end; //case
|
32
33
|
end;
|
33
34
|
|
34
|
-
class function Beer.
|
35
|
+
class function Beer.Recite(start, takeDown: integer): string;
|
35
36
|
var i: integer;
|
37
|
+
stop: integer;
|
38
|
+
verseNum: integer;
|
36
39
|
begin
|
40
|
+
stop := (start - takeDown) + 1;
|
37
41
|
result := '';
|
38
42
|
for i := start downto stop do
|
43
|
+
begin
|
44
|
+
verseNum := i;
|
45
|
+
if verseNum < 0 then
|
46
|
+
verseNum := verseNum + 100;
|
39
47
|
if i = stop then
|
40
|
-
result := result + Verse(
|
48
|
+
result := result + Verse(verseNum)
|
41
49
|
else
|
42
|
-
result := result + Verse(
|
50
|
+
result := result + Verse(verseNum) + '\n';
|
51
|
+
end;
|
43
52
|
end;
|
44
53
|
|
45
54
|
end.
|
@@ -4,42 +4,49 @@ interface
|
|
4
4
|
uses
|
5
5
|
DUnitX.TestFramework;
|
6
6
|
|
7
|
+
const
|
8
|
+
CanonicalVersion = '2.0.0';
|
9
|
+
|
7
10
|
type
|
8
11
|
|
9
|
-
[TestFixture('
|
10
|
-
|
12
|
+
[TestFixture('single verse')]
|
13
|
+
SingleVerseTests = class(TObject)
|
11
14
|
public
|
12
|
-
[
|
13
|
-
//
|
14
|
-
procedure
|
15
|
+
[TestCase('single verse','99,1')]
|
16
|
+
// [Ignore('Comment the "[Ignore]" statement to run the test')]
|
17
|
+
procedure first_generic_verse(const startBottles: integer; const takeDown: integer);
|
15
18
|
|
16
|
-
[
|
19
|
+
[TestCase('last generic verse','3,1')]
|
17
20
|
[Ignore]
|
18
|
-
procedure
|
21
|
+
procedure last_generic_verse(const startBottles: integer; const takeDown: integer);
|
19
22
|
|
20
|
-
[
|
23
|
+
[TestCase('verse with 2 bottles','2,1')]
|
21
24
|
[Ignore]
|
22
|
-
procedure
|
25
|
+
procedure verse_with_2_bottles(const startBottles: integer; const takeDown: integer);
|
23
26
|
|
24
|
-
[
|
27
|
+
[TestCase('verse with 1 bottle','1,1')]
|
25
28
|
[Ignore]
|
26
|
-
procedure
|
29
|
+
procedure verse_with_1_bottle(const startBottles: integer; const takeDown: integer);
|
27
30
|
|
28
|
-
[
|
31
|
+
[TestCase('verse with 0 bottles','0,1')]
|
29
32
|
[Ignore]
|
30
|
-
procedure
|
33
|
+
procedure verse_with_0_bottles(const startBottles: integer; const takeDown: integer);
|
31
34
|
end;
|
32
35
|
|
33
|
-
[TextFixture('
|
34
|
-
|
36
|
+
[TextFixture('multiple verses')]
|
37
|
+
MultipleVersesTests = class(TObject)
|
35
38
|
public
|
36
|
-
[
|
39
|
+
[TestCase('first two verses','99,2')]
|
40
|
+
[Ignore]
|
41
|
+
procedure first_two_verses(const startBottles: integer; const takeDown: integer);
|
42
|
+
|
43
|
+
[TestCase('last three verses','2,3')]
|
37
44
|
[Ignore]
|
38
|
-
procedure
|
45
|
+
procedure last_three_verses(const startBottles: integer; const takeDown: integer);
|
39
46
|
|
40
|
-
[
|
47
|
+
[TestCase('all verses','99,100')]
|
41
48
|
[Ignore]
|
42
|
-
procedure
|
49
|
+
procedure all_verses(const startBottles: integer; const takeDown: integer);
|
43
50
|
end;
|
44
51
|
|
45
52
|
implementation
|
@@ -47,71 +54,80 @@ uses System.SysUtils, System.Classes, uBeerSong;
|
|
47
54
|
|
48
55
|
var inputFile: TStringlist;
|
49
56
|
|
50
|
-
{$region '
|
57
|
+
{$region 'single verse'}
|
51
58
|
|
52
|
-
procedure
|
59
|
+
procedure SingleVerseTests.first_generic_verse(const startBottles: integer; const takeDown: integer);
|
53
60
|
var Expected,
|
54
61
|
Actual: string;
|
55
62
|
begin
|
56
63
|
Expected := inputFile[0];
|
57
|
-
Actual := Beer.
|
64
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
58
65
|
Assert.AreEqual(Expected, Actual);
|
59
66
|
end;
|
60
67
|
|
61
|
-
procedure
|
68
|
+
procedure SingleVerseTests.verse_with_1_bottle(const startBottles: integer; const takeDown: integer);
|
62
69
|
var Expected,
|
63
70
|
Actual: string;
|
64
71
|
begin
|
65
|
-
Expected := inputFile[
|
66
|
-
Actual := Beer.
|
72
|
+
Expected := inputFile[4];
|
73
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
67
74
|
Assert.AreEqual(Expected, Actual);
|
68
75
|
end;
|
69
76
|
|
70
|
-
procedure
|
77
|
+
procedure SingleVerseTests.verse_with_2_bottles(const startBottles: integer; const takeDown: integer);
|
71
78
|
var Expected,
|
72
79
|
Actual: string;
|
73
80
|
begin
|
74
81
|
Expected := inputFile[2];
|
75
|
-
Actual := Beer.
|
82
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
76
83
|
Assert.AreEqual(Expected, Actual);
|
77
84
|
end;
|
78
85
|
|
79
|
-
procedure
|
86
|
+
procedure SingleVerseTests.last_generic_verse(const startBottles: integer; const takeDown: integer);
|
80
87
|
var Expected,
|
81
88
|
Actual: string;
|
82
89
|
begin
|
83
90
|
Expected := inputFile[3];
|
84
|
-
Actual := Beer.
|
85
|
-
|
91
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
92
|
+
Assert.AreEqual(Expected, Actual);
|
86
93
|
end;
|
87
94
|
|
88
|
-
procedure
|
95
|
+
procedure SingleVerseTests.verse_with_0_bottles(const startBottles: integer; const takeDown: integer);
|
89
96
|
var Expected,
|
90
97
|
Actual: string;
|
91
98
|
begin
|
92
|
-
Expected := inputFile[
|
93
|
-
Actual := Beer.
|
94
|
-
|
99
|
+
Expected := inputFile[5];
|
100
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
101
|
+
Assert.AreEqual(Expected, Actual);
|
95
102
|
end;
|
96
103
|
{$endregion}
|
97
104
|
|
98
|
-
{$region '
|
105
|
+
{$region 'multiple verses'}
|
99
106
|
|
100
|
-
procedure
|
107
|
+
procedure MultipleVersesTests.first_two_verses(const startBottles: integer; const takeDown: integer);
|
101
108
|
var Expected,
|
102
109
|
Actual: string;
|
103
110
|
begin
|
104
|
-
Expected := inputFile[
|
105
|
-
Actual := Beer.
|
111
|
+
Expected := inputFile[7];
|
112
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
106
113
|
assert.AreEqual(Expected, Actual);
|
107
114
|
end;
|
108
115
|
|
109
|
-
procedure
|
116
|
+
procedure MultipleVersesTests.last_three_verses(const startBottles: integer; const takeDown: integer);
|
110
117
|
var Expected,
|
111
118
|
Actual: string;
|
112
119
|
begin
|
113
120
|
Expected := inputFile[6];
|
114
|
-
Actual := Beer.
|
121
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
122
|
+
assert.AreEqual(Expected, Actual);
|
123
|
+
end;
|
124
|
+
|
125
|
+
procedure MultipleVersesTests.all_verses(const startBottles: integer; const takeDown: integer);
|
126
|
+
var Expected,
|
127
|
+
Actual: string;
|
128
|
+
begin
|
129
|
+
Expected := inputFile[8];
|
130
|
+
Actual := Beer.Recite(startBottles,takeDown);
|
115
131
|
assert.AreEqual(Expected, Actual);
|
116
132
|
end;
|
117
133
|
|
@@ -125,8 +141,8 @@ end;
|
|
125
141
|
|
126
142
|
initialization
|
127
143
|
inputFile := loadInputData;
|
128
|
-
TDUnitX.RegisterTestFixture(
|
129
|
-
TDUnitX.RegisterTestFixture(
|
144
|
+
TDUnitX.RegisterTestFixture(SingleVerseTests);
|
145
|
+
TDUnitX.RegisterTestFixture(MultipleVersesTests);
|
130
146
|
|
131
147
|
finalization
|
132
148
|
inputFile.DisposeOf;
|
@@ -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:
|
@@ -781,6 +781,20 @@
|
|
781
781
|
"Text formatting"
|
782
782
|
]
|
783
783
|
},
|
784
|
+
{
|
785
|
+
"uuid": "03889544-064a-a980-2c2a-c7eb7d8407f8f737fb8",
|
786
|
+
"slug": "house",
|
787
|
+
"core": false,
|
788
|
+
"unlocked_by": "bob",
|
789
|
+
"difficulty": 4,
|
790
|
+
"topics": [
|
791
|
+
"Control-flow (conditionals)",
|
792
|
+
"Control-flow (loops)",
|
793
|
+
"Strings",
|
794
|
+
"Arrays",
|
795
|
+
"Recursion"
|
796
|
+
]
|
797
|
+
},
|
784
798
|
{
|
785
799
|
"uuid": "7c569e5d-bb00-44b8-8adc-34253790c19b",
|
786
800
|
"slug": "binary-search",
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# House
|
2
|
+
|
3
|
+
Recite the nursery rhyme 'This is the House that Jack Built'.
|
4
|
+
|
5
|
+
> [The] process of placing a phrase of clause within another phrase of
|
6
|
+
> clause is called embedding. It is through the processes of recursion
|
7
|
+
> and embedding that we are able to take a finite number of forms (words
|
8
|
+
> and phrases) and construct an infinite number of expressions.
|
9
|
+
> Furthermore, embedding also allows us to construct an infinitely long
|
10
|
+
> structure, in theory anyway.
|
11
|
+
|
12
|
+
- [papyr.com](http://papyr.com/hypertextbooks/grammar/ph_noun.htm)
|
13
|
+
|
14
|
+
The nursery rhyme reads as follows:
|
15
|
+
|
16
|
+
```text
|
17
|
+
This is the house that Jack built.
|
18
|
+
|
19
|
+
This is the malt
|
20
|
+
that lay in the house that Jack built.
|
21
|
+
|
22
|
+
This is the rat
|
23
|
+
that ate the malt
|
24
|
+
that lay in the house that Jack built.
|
25
|
+
|
26
|
+
This is the cat
|
27
|
+
that killed the rat
|
28
|
+
that ate the malt
|
29
|
+
that lay in the house that Jack built.
|
30
|
+
|
31
|
+
This is the dog
|
32
|
+
that worried the cat
|
33
|
+
that killed the rat
|
34
|
+
that ate the malt
|
35
|
+
that lay in the house that Jack built.
|
36
|
+
|
37
|
+
This is the cow with the crumpled horn
|
38
|
+
that tossed the dog
|
39
|
+
that worried the cat
|
40
|
+
that killed the rat
|
41
|
+
that ate the malt
|
42
|
+
that lay in the house that Jack built.
|
43
|
+
|
44
|
+
This is the maiden all forlorn
|
45
|
+
that milked the cow with the crumpled horn
|
46
|
+
that tossed the dog
|
47
|
+
that worried the cat
|
48
|
+
that killed the rat
|
49
|
+
that ate the malt
|
50
|
+
that lay in the house that Jack built.
|
51
|
+
|
52
|
+
This is the man all tattered and torn
|
53
|
+
that kissed the maiden all forlorn
|
54
|
+
that milked the cow with the crumpled horn
|
55
|
+
that tossed the dog
|
56
|
+
that worried the cat
|
57
|
+
that killed the rat
|
58
|
+
that ate the malt
|
59
|
+
that lay in the house that Jack built.
|
60
|
+
|
61
|
+
This is the priest all shaven and shorn
|
62
|
+
that married the man all tattered and torn
|
63
|
+
that kissed the maiden all forlorn
|
64
|
+
that milked the cow with the crumpled horn
|
65
|
+
that tossed the dog
|
66
|
+
that worried the cat
|
67
|
+
that killed the rat
|
68
|
+
that ate the malt
|
69
|
+
that lay in the house that Jack built.
|
70
|
+
|
71
|
+
This is the rooster that crowed in the morn
|
72
|
+
that woke the priest all shaven and shorn
|
73
|
+
that married the man all tattered and torn
|
74
|
+
that kissed the maiden all forlorn
|
75
|
+
that milked the cow with the crumpled horn
|
76
|
+
that tossed the dog
|
77
|
+
that worried the cat
|
78
|
+
that killed the rat
|
79
|
+
that ate the malt
|
80
|
+
that lay in the house that Jack built.
|
81
|
+
|
82
|
+
This is the farmer sowing his corn
|
83
|
+
that kept the rooster that crowed in the morn
|
84
|
+
that woke the priest all shaven and shorn
|
85
|
+
that married the man all tattered and torn
|
86
|
+
that kissed the maiden all forlorn
|
87
|
+
that milked the cow with the crumpled horn
|
88
|
+
that tossed the dog
|
89
|
+
that worried the cat
|
90
|
+
that killed the rat
|
91
|
+
that ate the malt
|
92
|
+
that lay in the house that Jack built.
|
93
|
+
|
94
|
+
This is the horse and the hound and the horn
|
95
|
+
that belonged to the farmer sowing his corn
|
96
|
+
that kept the rooster that crowed in the morn
|
97
|
+
that woke the priest all shaven and shorn
|
98
|
+
that married the man all tattered and torn
|
99
|
+
that kissed the maiden all forlorn
|
100
|
+
that milked the cow with the crumpled horn
|
101
|
+
that tossed the dog
|
102
|
+
that worried the cat
|
103
|
+
that killed the rat
|
104
|
+
that ate the malt
|
105
|
+
that lay in the house that Jack built.
|
106
|
+
```
|
107
|
+
|
108
|
+
## Hints
|
109
|
+
|
110
|
+
Try to capture the structure of the song in your code, where you build up the song by composing its parts.
|
111
|
+
|
112
|
+
## Setup
|
113
|
+
|
114
|
+
Go through the setup instructions for ECMAScript to
|
115
|
+
install the necessary dependencies:
|
116
|
+
|
117
|
+
http://exercism.io/languages/ecmascript
|
118
|
+
|
119
|
+
## Requirements
|
120
|
+
|
121
|
+
Install assignment dependencies:
|
122
|
+
|
123
|
+
```bash
|
124
|
+
$ npm install
|
125
|
+
```
|
126
|
+
|
127
|
+
## Making the test suite pass
|
128
|
+
|
129
|
+
Execute the tests with:
|
130
|
+
|
131
|
+
```bash
|
132
|
+
$ npm test
|
133
|
+
```
|
134
|
+
|
135
|
+
In the test suites all tests but the first have been skipped.
|
136
|
+
|
137
|
+
Once you get a test passing, you can enable the next one by
|
138
|
+
changing `xtest` to `test`.
|
139
|
+
|
140
|
+
|
141
|
+
## Source
|
142
|
+
|
143
|
+
British nursery rhyme http://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built
|
144
|
+
|
145
|
+
## Submitting Incomplete Solutions
|
146
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|