trackler 2.2.1.134 → 2.2.1.135

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/series/canonical-data.json +105 -0
  4. data/problem-specifications/exercises/series/description.md +6 -6
  5. data/problem-specifications/exercises/sieve/description.md +5 -3
  6. data/tracks/ceylon/exercises/sieve/README.md +5 -3
  7. data/tracks/fsharp/.gitignore +1 -0
  8. data/tracks/fsharp/docs/GENERATORS.md +314 -0
  9. data/tracks/fsharp/generators/Exercise.fs +39 -80
  10. data/tracks/fsharp/generators/Generators.fs +42 -40
  11. data/tracks/fsharp/generators/Generators.fsproj.user +6 -0
  12. data/tracks/haskell/exercises/crypto-square/README.md +4 -5
  13. data/tracks/haskell/exercises/isbn-verifier/package.yaml +1 -1
  14. data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +4 -0
  15. data/tracks/haskell/exercises/kindergarten-garden/package.yaml +1 -1
  16. data/tracks/haskell/exercises/series/README.md +6 -6
  17. data/tracks/haskell/exercises/series/examples/success-byteseqs/src/Series.hs +6 -8
  18. data/tracks/haskell/exercises/series/examples/success-standard/src/Series.hs +0 -1
  19. data/tracks/haskell/exercises/series/package.yaml +1 -1
  20. data/tracks/haskell/exercises/series/test/Tests.hs +17 -2
  21. data/tracks/haskell/exercises/sieve/README.md +5 -3
  22. data/tracks/java/CONTRIBUTING.md +5 -6
  23. data/tracks/java/exercises/book-store/.meta/version +1 -1
  24. data/tracks/java/exercises/change/.meta/version +1 -1
  25. data/tracks/java/exercises/circular-buffer/.meta/version +1 -1
  26. data/tracks/java/exercises/custom-set/.meta/version +1 -1
  27. data/tracks/java/exercises/forth/.meta/version +1 -1
  28. data/tracks/java/exercises/list-ops/.meta/version +1 -1
  29. data/tracks/java/exercises/minesweeper/.meta/version +1 -1
  30. data/tracks/java/exercises/ocr-numbers/.meta/version +1 -1
  31. data/tracks/java/exercises/wordy/.meta/version +1 -1
  32. data/tracks/nim/config.json +57 -44
  33. data/tracks/nim/exercises/pangram/README.md +26 -0
  34. data/tracks/nim/exercises/pangram/example.nim +9 -0
  35. data/tracks/nim/exercises/pangram/pangram_test.nim +35 -0
  36. data/tracks/nim/exercises/roman-numerals/README.md +61 -0
  37. data/tracks/nim/exercises/roman-numerals/example.nim +30 -0
  38. data/tracks/nim/exercises/roman-numerals/roman_numerals_test.nim +28 -0
  39. data/tracks/nim/exercises/scrabble-score/README.md +57 -0
  40. data/tracks/nim/exercises/scrabble-score/example.nim +13 -0
  41. data/tracks/nim/exercises/scrabble-score/scrabble_score_test.nim +37 -0
  42. data/tracks/perl5/README.md +2 -1
  43. data/tracks/perl5/cpanfile +2 -1
  44. data/tracks/perl5/exercises/grains/.meta/exercise-data.yaml +55 -0
  45. data/tracks/perl5/exercises/grains/.meta/solutions/Grains.pm +15 -23
  46. data/tracks/perl5/exercises/grains/Grains.pm +13 -0
  47. data/tracks/perl5/exercises/grains/cpanfile +1 -0
  48. data/tracks/perl5/exercises/grains/grains.t +136 -75
  49. data/tracks/ruby/README.md +0 -6
  50. data/tracks/rust/.travis.yml +1 -1
  51. data/tracks/rust/_test/check-stubs.sh +0 -0
  52. data/tracks/rust/_test/count-ignores.sh +0 -0
  53. data/tracks/rust/_test/ensure-lib-src-rs-exist.sh +0 -0
  54. data/tracks/rust/_test/ensure-readmes-are-updated.sh +0 -0
  55. data/tracks/rust/_test/ensure-stubs-compile.sh +0 -0
  56. data/tracks/rust/_test/verify-exercise-difficulties.sh +52 -0
  57. data/tracks/rust/config.json +4 -4
  58. data/tracks/swift/exercises/space-age/Tests/SpaceAgeTests/SpaceAgeTests.swift +15 -15
  59. data/tracks/typescript/config.json +46 -1
  60. data/tracks/typescript/exercises/bowling/README.md +93 -0
  61. data/tracks/typescript/exercises/bowling/bowling.example.ts +77 -0
  62. data/tracks/typescript/exercises/bowling/bowling.test.ts +137 -0
  63. data/tracks/typescript/exercises/bowling/bowling.ts +0 -0
  64. data/tracks/typescript/exercises/bowling/package.json +36 -0
  65. data/tracks/typescript/exercises/bowling/tsconfig.json +22 -0
  66. data/tracks/typescript/exercises/bowling/tslint.json +127 -0
  67. data/tracks/typescript/exercises/bowling/yarn.lock +2624 -0
  68. data/tracks/typescript/exercises/connect/README.md +59 -0
  69. data/tracks/typescript/exercises/connect/connect.example.ts +77 -0
  70. data/tracks/typescript/exercises/connect/connect.test.ts +108 -0
  71. data/tracks/typescript/exercises/connect/connect.ts +0 -0
  72. data/tracks/typescript/exercises/connect/package.json +36 -0
  73. data/tracks/typescript/exercises/connect/tsconfig.json +22 -0
  74. data/tracks/typescript/exercises/connect/tslint.json +127 -0
  75. data/tracks/typescript/exercises/connect/yarn.lock +2624 -0
  76. data/tracks/typescript/exercises/rectangles/README.md +92 -0
  77. data/tracks/typescript/exercises/rectangles/package.json +36 -0
  78. data/tracks/typescript/exercises/rectangles/rectangles.example.ts +59 -0
  79. data/tracks/typescript/exercises/rectangles/rectangles.test.ts +134 -0
  80. data/tracks/typescript/exercises/rectangles/rectangles.ts +0 -0
  81. data/tracks/typescript/exercises/rectangles/tsconfig.json +22 -0
  82. data/tracks/typescript/exercises/rectangles/tslint.json +127 -0
  83. data/tracks/typescript/exercises/rectangles/yarn.lock +2624 -0
  84. metadata +42 -2
@@ -0,0 +1,92 @@
1
+ # Rectangles
2
+
3
+ Count the rectangles in an ASCII diagram like the one below.
4
+
5
+ ```text
6
+ +--+
7
+ ++ |
8
+ +-++--+
9
+ | | |
10
+ +--+--+
11
+ ```
12
+
13
+ The above diagram contains 6 rectangles:
14
+
15
+ ```text
16
+
17
+
18
+ +-----+
19
+ | |
20
+ +-----+
21
+ ```
22
+
23
+ ```text
24
+ +--+
25
+ | |
26
+ | |
27
+ | |
28
+ +--+
29
+ ```
30
+
31
+ ```text
32
+ +--+
33
+ | |
34
+ +--+
35
+
36
+
37
+ ```
38
+
39
+ ```text
40
+
41
+
42
+ +--+
43
+ | |
44
+ +--+
45
+ ```
46
+
47
+ ```text
48
+
49
+
50
+ +--+
51
+ | |
52
+ +--+
53
+ ```
54
+
55
+ ```text
56
+
57
+ ++
58
+ ++
59
+
60
+
61
+ ```
62
+
63
+ You may assume that the input is always a proper rectangle (i.e. the length of
64
+ every line equals the length of the first line).
65
+
66
+ ## Setup
67
+
68
+ Go through the setup instructions for TypeScript to
69
+ install the necessary dependencies:
70
+
71
+ http://exercism.io/languages/typescript
72
+
73
+ ## Requirements
74
+
75
+ Install assignment dependencies:
76
+
77
+ ```bash
78
+ $ yarn install
79
+ ```
80
+
81
+ ## Making the test suite pass
82
+
83
+ Execute the tests with:
84
+
85
+ ```bash
86
+ $ yarn test
87
+ ```
88
+
89
+
90
+
91
+ ## Submitting Incomplete Solutions
92
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "xtypescript",
3
+ "version": "1.0.0",
4
+ "description": "Exercism exercises in Typescript.",
5
+ "author": "",
6
+ "private": true,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/exercism/xtypescript"
10
+ },
11
+ "devDependencies": {},
12
+ "scripts": {
13
+ "test": "tsc --noEmit -p . && jest --no-cache",
14
+ "lint": "tsc --noEmit -p . && tslint \"*.ts?(x)\"",
15
+ "lintci": "tslint \"*.ts?(x)\" --force"
16
+ },
17
+ "dependencies": {
18
+ "@types/jest": "^21.1.5",
19
+ "@types/node": "^8.0.47",
20
+ "jest": "^21.2.1",
21
+ "ts-jest": "^21.1.3",
22
+ "tslint": "^5.8.0",
23
+ "typescript": "^2.5.3"
24
+ },
25
+ "jest": {
26
+ "transform": {
27
+ ".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
28
+ },
29
+ "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
30
+ "moduleFileExtensions": [
31
+ "ts",
32
+ "tsx",
33
+ "js"
34
+ ]
35
+ }
36
+ }
@@ -0,0 +1,59 @@
1
+ class Rectangles {
2
+
3
+ static count(diagram: string[]) {
4
+ const rows = diagram.length
5
+ const cols = rows ? diagram[0].length : 0
6
+
7
+ let rectangles = 0
8
+
9
+ // All possible topleft corners
10
+ for (let y = 0; y < rows - 1; y++) {
11
+ for (let x = 0; x < cols - 1; x++) {
12
+ if (diagram[y].charAt(x) === '+') {
13
+ // All possible bottomright corners
14
+ for (let j = y + 1; j < rows; j++) {
15
+ for (let i = x + 1; i < cols; i++) {
16
+ // Check if all corners are valid
17
+ if (diagram[j].charAt(i) === '+' && diagram[y].charAt(i) === '+' && diagram[j].charAt(x) === '+') {
18
+ let validRectangle = true
19
+
20
+ // Check if all sides are valid
21
+ for (let s = x + 1; s < i; s++) {
22
+ if (!'+-'.includes(diagram[y].charAt(s))) {
23
+ validRectangle = false
24
+ }
25
+ }
26
+
27
+ for (let s = x + 1; s < i; s++) {
28
+ if (!'+-'.includes(diagram[j].charAt(s))) {
29
+ validRectangle = false
30
+ }
31
+ }
32
+
33
+ for (let t = y + 1; t < j; t++) {
34
+ if (!'+|'.includes(diagram[t].charAt(x))) {
35
+ validRectangle = false
36
+ }
37
+ }
38
+
39
+ for (let t = y + 1; t < j; t++) {
40
+ if (!'+|'.includes(diagram[t].charAt(i))) {
41
+ validRectangle = false
42
+ }
43
+ }
44
+
45
+ if (validRectangle) {
46
+ rectangles++
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ return rectangles
56
+ }
57
+ }
58
+
59
+ export default Rectangles
@@ -0,0 +1,134 @@
1
+ import Rectangles from './rectangles'
2
+
3
+ describe('Rectangles', () => {
4
+ it('no rows', () => {
5
+ const expected = 0
6
+ const actual = Rectangles.count([])
7
+ expect(actual).toEqual(expected)
8
+ })
9
+
10
+ xit('no columns', () => {
11
+ const expected = 0
12
+ const actual = Rectangles.count([''])
13
+ expect(actual).toEqual(expected)
14
+ })
15
+
16
+ xit('no rectangles', () => {
17
+ const expected = 0
18
+ const actual = Rectangles.count([' '])
19
+ expect(actual).toEqual(expected)
20
+ })
21
+
22
+ xit('one rectangle', () => {
23
+ const expected = 1
24
+ const actual = Rectangles.count([
25
+ '+-+',
26
+ '| |',
27
+ '+-+',
28
+ ])
29
+ expect(actual).toEqual(expected)
30
+ })
31
+
32
+ xit('two rectangles without shared parts', () => {
33
+ const expected = 2
34
+ const actual = Rectangles.count([
35
+ ' +-+',
36
+ ' | |',
37
+ '+-+-+',
38
+ '| | ',
39
+ '+-+ ',
40
+ ])
41
+ expect(actual).toEqual(expected)
42
+ })
43
+
44
+ xit('five rectangles with shared parts', () => {
45
+ const expected = 5
46
+ const actual = Rectangles.count([
47
+ ' +-+',
48
+ ' | |',
49
+ '+-+-+',
50
+ '| | |',
51
+ '+-+-+',
52
+ ])
53
+ expect(actual).toEqual(expected)
54
+ })
55
+
56
+ xit('rectangle of height 1 is counted', () => {
57
+ const expected = 1
58
+ const actual = Rectangles.count([
59
+ '+--+',
60
+ '+--+',
61
+ ])
62
+ expect(actual).toEqual(expected)
63
+ })
64
+
65
+ xit('rectangle of width 1 is counted', () => {
66
+ const expected = 1
67
+ const actual = Rectangles.count([
68
+ '++',
69
+ '||',
70
+ '++',
71
+ ])
72
+ expect(actual).toEqual(expected)
73
+ })
74
+
75
+ xit('1x1 square is counted', () => {
76
+ const expected = 1
77
+ const actual = Rectangles.count([
78
+ '++',
79
+ '++',
80
+ ])
81
+ expect(actual).toEqual(expected)
82
+ })
83
+
84
+ xit('only complete rectangles are counted', () => {
85
+ const expected = 1
86
+ const actual = Rectangles.count([
87
+ ' +-+',
88
+ ' |',
89
+ '+-+-+',
90
+ '| | -',
91
+ '+-+-+',
92
+ ])
93
+ expect(actual).toEqual(expected)
94
+ })
95
+
96
+ xit('rectangles can be of different sizes', () => {
97
+ const expected = 3
98
+ const actual = Rectangles.count([
99
+ '+------+----+',
100
+ '| | |',
101
+ '+---+--+ |',
102
+ '| | |',
103
+ '+---+-------+',
104
+ ])
105
+ expect(actual).toEqual(expected)
106
+ })
107
+
108
+ xit('corner is required for a rectangle to be complete', () => {
109
+ const expected = 2
110
+ const actual = Rectangles.count([
111
+ '+------+----+',
112
+ '| | |',
113
+ '+------+ |',
114
+ '| | |',
115
+ '+---+-------+',
116
+ ])
117
+ expect(actual).toEqual(expected)
118
+ })
119
+
120
+ xit('large input with many rectangles', () => {
121
+ const expected = 60
122
+ const actual = Rectangles.count([
123
+ '+---+--+----+',
124
+ '| +--+----+',
125
+ '+---+--+ |',
126
+ '| +--+----+',
127
+ '+---+--+--+-+',
128
+ '+---+--+--+-+',
129
+ '+------+ | |',
130
+ ' +-+',
131
+ ])
132
+ expect(actual).toEqual(expected)
133
+ })
134
+ })
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2017",
4
+ "module": "commonjs",
5
+ "alwaysStrict": true,
6
+ "noUnusedLocals": true,
7
+ "noUnusedParameters": true,
8
+ "noImplicitAny": true,
9
+ "strictNullChecks": true,
10
+ "preserveConstEnums": true,
11
+ "noFallthroughCasesInSwitch":true,
12
+ "noImplicitThis":true,
13
+ "noImplicitReturns":true,
14
+ "sourceMap": true,
15
+ "noEmitOnError": true,
16
+ "outDir": "./build"
17
+ },
18
+ "compileOnSave": true,
19
+ "exclude": [
20
+ "node_modules"
21
+ ]
22
+ }
@@ -0,0 +1,127 @@
1
+ {
2
+ "jsRules": {
3
+ "class-name": true,
4
+ "comment-format": [
5
+ true,
6
+ "check-space"
7
+ ],
8
+ "indent": [
9
+ true,
10
+ "spaces"
11
+ ],
12
+ "no-duplicate-variable": true,
13
+ "no-eval": true,
14
+ "no-trailing-whitespace": true,
15
+ "no-unsafe-finally": true,
16
+ "one-line": [
17
+ true,
18
+ "check-open-brace",
19
+ "check-whitespace"
20
+ ],
21
+ "quotemark": [
22
+ false,
23
+ "double"
24
+ ],
25
+ "semicolon": [
26
+ true,
27
+ "never"
28
+ ],
29
+ "triple-equals": [
30
+ true,
31
+ "allow-null-check"
32
+ ],
33
+ "variable-name": [
34
+ true,
35
+ "ban-keywords"
36
+ ],
37
+ "whitespace": [
38
+ true,
39
+ "check-branch",
40
+ "check-decl",
41
+ "check-operator",
42
+ "check-separator",
43
+ "check-type"
44
+ ]
45
+ },
46
+ "rules": {
47
+ "class-name": true,
48
+ "comment-format": [
49
+ true,
50
+ "check-space"
51
+ ],
52
+ "indent": [
53
+ true,
54
+ "spaces"
55
+ ],
56
+ "no-eval": true,
57
+ "no-internal-module": true,
58
+ "no-trailing-whitespace": true,
59
+ "no-unsafe-finally": true,
60
+ "no-var-keyword": true,
61
+ "one-line": [
62
+ true,
63
+ "check-open-brace",
64
+ "check-whitespace"
65
+ ],
66
+ "semicolon": [
67
+ true,
68
+ "never"
69
+ ],
70
+ "triple-equals": [
71
+ true,
72
+ "allow-null-check"
73
+ ],
74
+ "typedef-whitespace": [
75
+ true,
76
+ {
77
+ "call-signature": "nospace",
78
+ "index-signature": "nospace",
79
+ "parameter": "nospace",
80
+ "property-declaration": "nospace",
81
+ "variable-declaration": "nospace"
82
+ }
83
+ ],
84
+ "variable-name": [
85
+ true,
86
+ "ban-keywords"
87
+ ],
88
+ "whitespace": [
89
+ true,
90
+ "check-branch",
91
+ "check-decl",
92
+ "check-operator",
93
+ "check-separator",
94
+ "check-type"
95
+ ],
96
+ "no-namespace": true,
97
+ "prefer-for-of": true,
98
+ "only-arrow-functions": [true, "allow-declarations"],
99
+ "no-var-requires": true,
100
+ "no-any": true,
101
+ "curly": true,
102
+ "forin": true,
103
+ "no-arg": true,
104
+ "label-position": true,
105
+ "no-conditional-assignment": true,
106
+ "no-console": [true, "log", "error"],
107
+ "no-construct": true,
108
+ "no-duplicate-variable": true,
109
+ "no-empty": true,
110
+ "no-invalid-this": [true, "check-function-in-method"],
111
+ "no-misused-new": true,
112
+ "no-null-keyword": true,
113
+ "no-string-literal": true,
114
+ "radix": true,
115
+ "typeof-compare": true,
116
+ "use-isnan": true,
117
+ "prefer-const": true,
118
+ "array-type": [true, "array-simple"],
119
+ "arrow-parens": true,
120
+ "new-parens": true,
121
+ "no-consecutive-blank-lines": [true,1],
122
+ "no-parameter-properties": true,
123
+ "no-unnecessary-initializer": true,
124
+ "object-literal-shorthand": true,
125
+ "object-literal-key-quotes": [true, "as-needed"]
126
+ }
127
+ }