trackler 2.0.3.0 → 2.0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fixtures/common/exercises/no-metadata/description.md +1 -0
- data/lib/trackler/problem.rb +12 -0
- data/lib/trackler/problems.rb +8 -12
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/README.md +2 -0
- data/tracks/c/config.json +9 -2
- data/tracks/c/exercises/sieve/makefile +15 -0
- data/tracks/c/exercises/sieve/src/example.c +50 -0
- data/tracks/c/exercises/sieve/src/sieve.h +10 -0
- data/tracks/c/exercises/sieve/test/test_sieve.c +113 -0
- data/tracks/c/exercises/sieve/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/sieve/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/sieve/test/vendor/unity_internals.h +701 -0
- data/tracks/coffeescript/.travis.yml +1 -0
- data/tracks/coldfusion/.travis.yml +1 -0
- data/tracks/crystal/Makefile +18 -15
- data/tracks/crystal/README.md +5 -5
- data/tracks/crystal/config.json +6 -0
- data/tracks/crystal/exercises/acronym/src/acronym.cr +1 -0
- data/tracks/crystal/exercises/anagram/src/anagram.cr +1 -0
- data/tracks/crystal/exercises/atbash-cipher/src/atbash_cipher.cr +1 -0
- data/tracks/crystal/exercises/binary/src/binary.cr +1 -0
- data/tracks/crystal/exercises/bob/src/bob.cr +1 -0
- data/tracks/crystal/exercises/bracket-push/src/bracket_push.cr +1 -0
- data/tracks/crystal/exercises/difference-of-squares/spec/difference_of_squares_spec.cr +44 -0
- data/tracks/crystal/exercises/difference-of-squares/src/example.cr +15 -0
- data/tracks/crystal/exercises/forth/src/forth.cr +1 -0
- data/tracks/crystal/exercises/gigasecond/src/gigasecond.cr +1 -0
- data/tracks/crystal/exercises/hamming/src/hamming.cr +1 -0
- data/tracks/crystal/exercises/hello-world/src/hello_world.cr +1 -0
- data/tracks/crystal/exercises/largest-series-product/src/largest_series_product.cr +1 -0
- data/tracks/crystal/exercises/leap/src/leap.cr +1 -0
- data/tracks/crystal/exercises/pangram/src/pangram.cr +1 -0
- data/tracks/crystal/exercises/raindrops/src/raindrops.cr +1 -0
- data/tracks/crystal/exercises/react/src/react.cr +1 -0
- data/tracks/crystal/exercises/rna-transcription/src/rna_transcription.cr +1 -0
- data/tracks/crystal/exercises/roman-numerals/src/roman_numerals.cr +1 -0
- data/tracks/crystal/exercises/sieve/src/sieve.cr +1 -0
- data/tracks/crystal/src/generator/exercises/difference_of_squares.cr +39 -0
- data/tracks/go/exercises/allergies/allergies_test.go +2 -2
- data/tracks/go/exercises/anagram/anagram_test.go +3 -3
- data/tracks/go/exercises/grade-school/grade_school_test.go +3 -3
- data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +1 -1
- data/tracks/java/config.json +13 -1
- data/tracks/java/exercises/binary-search-tree/build.gradle +18 -0
- data/tracks/java/exercises/binary-search-tree/src/example/java/BST.java +122 -0
- data/tracks/java/exercises/binary-search-tree/src/main/java/.keep +0 -0
- data/tracks/java/exercises/binary-search-tree/src/test/java/.keep +0 -0
- data/tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java +163 -0
- data/tracks/java/exercises/pythagorean-triplet/build.gradle +18 -0
- data/tracks/java/exercises/pythagorean-triplet/src/example/java/PythagoreanTriplet.java +117 -0
- data/tracks/java/exercises/pythagorean-triplet/src/main/java/PythagoreanTriplet.java +3 -0
- data/tracks/java/exercises/pythagorean-triplet/src/test/java/PythagoreanTripletTest.java +95 -0
- data/tracks/java/exercises/settings.gradle +2 -0
- data/tracks/julia/README.md +16 -0
- data/tracks/perl5/README.md +2 -0
- data/tracks/perl6/README.md +2 -1
- data/tracks/php/config.json +5 -0
- data/tracks/php/exercises/sieve/example.php +29 -0
- data/tracks/php/exercises/sieve/sieve_test.php +201 -0
- data/tracks/pony/.travis.yml +1 -0
- data/tracks/python/exercises/anagram/anagram_test.py +1 -0
- data/tracks/python/exercises/beer-song/beer_song_test.py +1 -0
- data/tracks/python/exercises/binary-search/binary_search_test.py +1 -0
- data/tracks/python/exercises/binary/binary_test.py +1 -0
- data/tracks/python/exercises/bob/bob_test.py +1 -0
- data/tracks/python/exercises/clock/clock_test.py +1 -0
- data/tracks/python/exercises/etl/etl_test.py +1 -0
- data/tracks/python/exercises/gigasecond/gigasecond_test.py +1 -0
- data/tracks/python/exercises/grains/grains_test.py +1 -0
- data/tracks/python/exercises/leap/leap_test.py +1 -0
- data/tracks/python/exercises/meetup/meetup_test.py +1 -0
- data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +1 -0
- data/tracks/python/exercises/ocr-numbers/example.py +1 -0
- data/tracks/python/exercises/ocr-numbers/ocr_test.py +1 -0
- data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +1 -0
- data/tracks/python/exercises/phone-number/phone_number_test.py +1 -0
- data/tracks/python/exercises/pig-latin/pig_latin_test.py +1 -0
- data/tracks/python/exercises/point-mutations/point_mutations_test.py +1 -0
- data/tracks/python/exercises/poker/poker_test.py +1 -0
- data/tracks/python/exercises/prime-factors/prime_factors_test.py +1 -0
- data/tracks/python/exercises/pythagorean-triplet/example.py +2 -3
- data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher_test.py +1 -0
- data/tracks/python/exercises/raindrops/raindrops_test.py +1 -0
- data/tracks/python/exercises/rectangles/rectangles_count_test.py +1 -0
- data/tracks/python/exercises/robot-simulator/robot_simulator_test.py +1 -0
- data/tracks/python/exercises/roman-numerals/roman_numerals_test.py +1 -0
- data/tracks/python/exercises/run-length-encoding/run_length_test.py +1 -0
- data/tracks/python/exercises/say/say_test.py +1 -0
- data/tracks/python/exercises/scrabble-score/scrabble_score_test.py +1 -0
- data/tracks/python/exercises/sieve/sieve_test.py +1 -0
- data/tracks/python/exercises/space-age/space_age_test.py +1 -0
- data/tracks/python/exercises/triangle/triangle_test.py +1 -0
- data/tracks/python/exercises/word-count/word_count_test.py +1 -0
- data/tracks/python/requirements-travis.txt +1 -1
- data/tracks/ruby/docs/24pullrequests.md +21 -0
- data/tracks/ruby/exercises/bowling/.version +1 -1
- data/tracks/ruby/exercises/bowling/bowling_test.rb +44 -15
- data/tracks/ruby/exercises/bowling/example.rb +10 -5
- data/tracks/ruby/exercises/bowling/example.tt +4 -2
- data/tracks/ruby/lib/bowling_cases.rb +1 -1
- data/tracks/scala/exercises/bank-account/HINTS.md +11 -0
- data/tracks/scala/exercises/bank-account/example.scala +2 -4
- data/tracks/scala/exercises/bank-account/src/main/scala/BankAccount.scala +13 -0
- data/tracks/scala/exercises/bank-account/src/test/scala/BankAccountTest.scala +5 -5
- data/tracks/scala/exercises/hamming/HINTS.md +57 -0
- data/tracks/scala/exercises/hello-world/HINTS.md +8 -0
- data/tracks/scala/exercises/nucleotide-count/HINTS.md +61 -0
- metadata +48 -2
data/tracks/perl6/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# xPerl6
|
2
2
|
|
3
|
+
[![Gitter](https://badges.gitter.im/exercism/xperl.svg)](https://gitter.im/exercism/xperl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
3
4
|
Exercism exercises in Perl 6
|
4
5
|
|
5
6
|
## Contributing Guide
|
@@ -13,4 +14,4 @@ The MIT License (MIT)
|
|
13
14
|
Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
|
14
15
|
|
15
16
|
### Perl 6 icon
|
16
|
-
The Perl 6 "Camelia" logo is owned by Larry Wall and is released under version 2.0 of the Artistic License. We are using it to identify the Perl 6 language itself, not any part of Exercism, which we believe to be admissible under fair use. The version of the logo that we are using is a pink, black and white adaptation of the logo found on <http://en.wikipedia.org/wiki/Perl_6>.
|
17
|
+
The Perl 6 "Camelia" logo is owned by Larry Wall and is released under version 2.0 of the Artistic License. We are using it to identify the Perl 6 language itself, not any part of Exercism, which we believe to be admissible under fair use. The version of the logo that we are using is a pink, black and white adaptation of the logo found on <http://en.wikipedia.org/wiki/Perl_6>.
|
data/tracks/php/config.json
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
<?php
|
2
|
+
function sieve($number)
|
3
|
+
{
|
4
|
+
if ($number == 1) {
|
5
|
+
return [];
|
6
|
+
}
|
7
|
+
$candidates = _getNumbersFrom2To($number);
|
8
|
+
foreach ($candidates as $prime) {
|
9
|
+
foreach ($candidates as $key => $multiple) {
|
10
|
+
if (_areDifferent($multiple, $prime) && _areMultiples($multiple, $prime)) {
|
11
|
+
unset($candidates[$key]);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
return array_values($candidates);
|
16
|
+
}
|
17
|
+
function _getNumbersFrom2To($number): array
|
18
|
+
{
|
19
|
+
$candidates = range(2, $number);
|
20
|
+
return $candidates;
|
21
|
+
}
|
22
|
+
function _areDifferent($multiple, $prime): bool
|
23
|
+
{
|
24
|
+
return ($multiple != $prime);
|
25
|
+
}
|
26
|
+
function _areMultiples($multiple, $prime): bool
|
27
|
+
{
|
28
|
+
return ($multiple % $prime == 0);
|
29
|
+
}
|
@@ -0,0 +1,201 @@
|
|
1
|
+
<?php
|
2
|
+
require "sieve.php";
|
3
|
+
class SieveTest extends PHPUnit_Framework_TestCase
|
4
|
+
{
|
5
|
+
public function testNoPrimesUnderTwo()
|
6
|
+
{
|
7
|
+
$this->assertEquals([], sieve(1));
|
8
|
+
}
|
9
|
+
public function testFindFirstPrime()
|
10
|
+
{
|
11
|
+
$this->markTestSkipped();
|
12
|
+
$this->assertEquals([2], sieve(2));
|
13
|
+
}
|
14
|
+
public function testFindPrimesUpTo10()
|
15
|
+
{
|
16
|
+
$this->markTestSkipped();
|
17
|
+
$this->assertEquals([2, 3, 5, 7], sieve(10));
|
18
|
+
}
|
19
|
+
public function testLimitIsPrime()
|
20
|
+
{
|
21
|
+
$this->markTestSkipped();
|
22
|
+
$this->assertEquals([2, 3, 5, 7, 11, 13], sieve(13));
|
23
|
+
}
|
24
|
+
public function testFindPrimesUpTo1000()
|
25
|
+
{
|
26
|
+
$this->markTestSkipped();
|
27
|
+
$this->assertEquals(
|
28
|
+
[
|
29
|
+
2,
|
30
|
+
3,
|
31
|
+
5,
|
32
|
+
7,
|
33
|
+
11,
|
34
|
+
13,
|
35
|
+
17,
|
36
|
+
19,
|
37
|
+
23,
|
38
|
+
29,
|
39
|
+
31,
|
40
|
+
37,
|
41
|
+
41,
|
42
|
+
43,
|
43
|
+
47,
|
44
|
+
53,
|
45
|
+
59,
|
46
|
+
61,
|
47
|
+
67,
|
48
|
+
71,
|
49
|
+
73,
|
50
|
+
79,
|
51
|
+
83,
|
52
|
+
89,
|
53
|
+
97,
|
54
|
+
101,
|
55
|
+
103,
|
56
|
+
107,
|
57
|
+
109,
|
58
|
+
113,
|
59
|
+
127,
|
60
|
+
131,
|
61
|
+
137,
|
62
|
+
139,
|
63
|
+
149,
|
64
|
+
151,
|
65
|
+
157,
|
66
|
+
163,
|
67
|
+
167,
|
68
|
+
173,
|
69
|
+
179,
|
70
|
+
181,
|
71
|
+
191,
|
72
|
+
193,
|
73
|
+
197,
|
74
|
+
199,
|
75
|
+
211,
|
76
|
+
223,
|
77
|
+
227,
|
78
|
+
229,
|
79
|
+
233,
|
80
|
+
239,
|
81
|
+
241,
|
82
|
+
251,
|
83
|
+
257,
|
84
|
+
263,
|
85
|
+
269,
|
86
|
+
271,
|
87
|
+
277,
|
88
|
+
281,
|
89
|
+
283,
|
90
|
+
293,
|
91
|
+
307,
|
92
|
+
311,
|
93
|
+
313,
|
94
|
+
317,
|
95
|
+
331,
|
96
|
+
337,
|
97
|
+
347,
|
98
|
+
349,
|
99
|
+
353,
|
100
|
+
359,
|
101
|
+
367,
|
102
|
+
373,
|
103
|
+
379,
|
104
|
+
383,
|
105
|
+
389,
|
106
|
+
397,
|
107
|
+
401,
|
108
|
+
409,
|
109
|
+
419,
|
110
|
+
421,
|
111
|
+
431,
|
112
|
+
433,
|
113
|
+
439,
|
114
|
+
443,
|
115
|
+
449,
|
116
|
+
457,
|
117
|
+
461,
|
118
|
+
463,
|
119
|
+
467,
|
120
|
+
479,
|
121
|
+
487,
|
122
|
+
491,
|
123
|
+
499,
|
124
|
+
503,
|
125
|
+
509,
|
126
|
+
521,
|
127
|
+
523,
|
128
|
+
541,
|
129
|
+
547,
|
130
|
+
557,
|
131
|
+
563,
|
132
|
+
569,
|
133
|
+
571,
|
134
|
+
577,
|
135
|
+
587,
|
136
|
+
593,
|
137
|
+
599,
|
138
|
+
601,
|
139
|
+
607,
|
140
|
+
613,
|
141
|
+
617,
|
142
|
+
619,
|
143
|
+
631,
|
144
|
+
641,
|
145
|
+
643,
|
146
|
+
647,
|
147
|
+
653,
|
148
|
+
659,
|
149
|
+
661,
|
150
|
+
673,
|
151
|
+
677,
|
152
|
+
683,
|
153
|
+
691,
|
154
|
+
701,
|
155
|
+
709,
|
156
|
+
719,
|
157
|
+
727,
|
158
|
+
733,
|
159
|
+
739,
|
160
|
+
743,
|
161
|
+
751,
|
162
|
+
757,
|
163
|
+
761,
|
164
|
+
769,
|
165
|
+
773,
|
166
|
+
787,
|
167
|
+
797,
|
168
|
+
809,
|
169
|
+
811,
|
170
|
+
821,
|
171
|
+
823,
|
172
|
+
827,
|
173
|
+
829,
|
174
|
+
839,
|
175
|
+
853,
|
176
|
+
857,
|
177
|
+
859,
|
178
|
+
863,
|
179
|
+
877,
|
180
|
+
881,
|
181
|
+
883,
|
182
|
+
887,
|
183
|
+
907,
|
184
|
+
911,
|
185
|
+
919,
|
186
|
+
929,
|
187
|
+
937,
|
188
|
+
941,
|
189
|
+
947,
|
190
|
+
953,
|
191
|
+
967,
|
192
|
+
971,
|
193
|
+
977,
|
194
|
+
983,
|
195
|
+
991,
|
196
|
+
997
|
197
|
+
],
|
198
|
+
sieve(1000)
|
199
|
+
);
|
200
|
+
}
|
201
|
+
}
|
data/tracks/pony/.travis.yml
CHANGED
@@ -14,9 +14,7 @@ def primitive_triplets(nbr):
|
|
14
14
|
factors = [(m, n) for m, n in zip(reversed(a), a) if m > n]
|
15
15
|
ts = set()
|
16
16
|
for m, n in factors:
|
17
|
-
|
18
|
-
l.sort()
|
19
|
-
ts.update([tuple(l)])
|
17
|
+
ts.update([tuple(sorted([nbr, m * m - n * n, m * m + n * n]))])
|
20
18
|
return ts
|
21
19
|
|
22
20
|
|
@@ -36,6 +34,7 @@ def triplets_in_range(m, n):
|
|
36
34
|
t.update([(a, b, c)])
|
37
35
|
return t
|
38
36
|
|
37
|
+
|
39
38
|
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
|
40
39
|
67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
|
41
40
|
139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211,
|