trackler 2.2.1.125 → 2.2.1.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/isbn-verifier/canonical-data.json +2 -2
  4. data/tracks/erlang/README.md +5 -5
  5. data/tracks/erlang/config.json +10 -0
  6. data/tracks/erlang/docs/INSTALLATION.md +1 -1
  7. data/tracks/erlang/exercises/isbn-verifier/README.md +80 -0
  8. data/tracks/erlang/exercises/isbn-verifier/rebar.config +30 -0
  9. data/tracks/erlang/exercises/isbn-verifier/src/example.erl +13 -0
  10. data/tracks/erlang/exercises/isbn-verifier/src/isbn_verifier.app.src +9 -0
  11. data/tracks/erlang/exercises/isbn-verifier/src/isbn_verifier.erl +7 -0
  12. data/tracks/erlang/exercises/isbn-verifier/test/isbn_verifier_tests.erl +48 -0
  13. data/tracks/haskell/exercises/isbn-verifier/package.yaml +1 -1
  14. data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +1 -1
  15. data/tracks/javascript/.eslintignore +0 -1
  16. data/tracks/javascript/exercises/robot-simulator/example.js +70 -72
  17. data/tracks/typescript/config.json +34 -2
  18. data/tracks/typescript/exercises/all-your-base/README.md +60 -0
  19. data/tracks/typescript/exercises/all-your-base/all-your-base.example.ts +53 -0
  20. data/tracks/typescript/exercises/all-your-base/all-your-base.test.ts +119 -0
  21. data/tracks/typescript/exercises/all-your-base/all-your-base.ts +0 -0
  22. data/tracks/typescript/exercises/all-your-base/package.json +36 -0
  23. data/tracks/typescript/exercises/all-your-base/tsconfig.json +22 -0
  24. data/tracks/typescript/exercises/all-your-base/tslint.json +127 -0
  25. data/tracks/typescript/exercises/all-your-base/yarn.lock +2624 -0
  26. data/tracks/typescript/exercises/anagram/anagram.example.ts +3 -3
  27. data/tracks/typescript/exercises/anagram/anagram.test.ts +55 -57
  28. data/tracks/typescript/exercises/anagram/anagram.ts +0 -5
  29. data/tracks/typescript/exercises/crypto-square/README.md +102 -0
  30. data/tracks/typescript/exercises/crypto-square/crypto-square.example.ts +59 -0
  31. data/tracks/typescript/exercises/crypto-square/crypto-square.test.ts +53 -0
  32. data/tracks/typescript/exercises/crypto-square/crypto-square.ts +0 -0
  33. data/tracks/typescript/exercises/crypto-square/package.json +36 -0
  34. data/tracks/typescript/exercises/crypto-square/tsconfig.json +22 -0
  35. data/tracks/typescript/exercises/crypto-square/tslint.json +127 -0
  36. data/tracks/typescript/exercises/crypto-square/yarn.lock +2624 -0
  37. data/tracks/typescript/exercises/kindergarten-garden/kindergarten-garden.example.ts +40 -40
  38. data/tracks/typescript/exercises/kindergarten-garden/kindergarten-garden.test.ts +118 -118
  39. data/tracks/typescript/exercises/kindergarten-garden/kindergarten-garden.ts +0 -7
  40. metadata +24 -2
@@ -8,11 +8,11 @@ class Anagram {
8
8
  this.value = input
9
9
  }
10
10
 
11
- matches(...input: string[]): string[] {
11
+ matches(...input: string[]): string[] {
12
12
  const result: string[] = []
13
13
  for (const each of input) {
14
- if ( sort(each) === sort(this.value) ) {
15
- if (each.toLowerCase() === this.value.toLowerCase()) {continue}
14
+ if (sort(each) === sort(this.value)) {
15
+ if (each.toLowerCase() === this.value.toLowerCase()) { continue }
16
16
  result.push(each)
17
17
  }
18
18
  }
@@ -1,82 +1,80 @@
1
1
  import Anagram from './anagram'
2
2
 
3
3
  describe('Anagram', () => {
4
+ it("no matches", () => {
5
+ const subject = new Anagram("diaper")
6
+ const matches = subject.matches(...["hello", "world", "zombies", "pants"])
4
7
 
5
- it("no matches", () => {
6
- const subject = new Anagram("diaper")
7
- const matches = subject.matches(...[ "hello", "world", "zombies", "pants"])
8
+ expect(matches).toEqual([])
9
+ })
8
10
 
9
- expect(matches).toEqual([])
10
- })
11
+ xit("detects simple anagram", () => {
12
+ const subject = new Anagram("ant")
13
+ const matches = subject.matches(...['tan', 'stand', 'at'])
11
14
 
12
- xit("detects simple anagram", () => {
13
- const subject = new Anagram("ant")
14
- const matches = subject.matches(...['tan', 'stand', 'at'])
15
+ expect(matches).toEqual(['tan'])
16
+ })
15
17
 
16
- expect(matches).toEqual(['tan'])
17
- })
18
+ xit("does not detect false positives", () => {
19
+ const subject = new Anagram("galea")
20
+ const matches = subject.matches(...["eagle"])
18
21
 
19
- xit("does not detect false positives", () => {
20
- const subject = new Anagram("galea")
21
- const matches = subject.matches(...["eagle"])
22
+ expect(matches).toEqual([])
23
+ })
22
24
 
23
- expect(matches).toEqual([])
24
- })
25
+ xit("detects multiple anagrams", () => {
26
+ const subject = new Anagram("master")
27
+ const matches = subject.matches(...['stream', 'pigeon', 'maters'])
25
28
 
26
- xit("detects multiple anagrams", () => {
27
- const subject = new Anagram("master")
28
- const matches = subject.matches(...['stream', 'pigeon', 'maters'])
29
+ expect(matches).toEqual(['stream', 'maters'])
30
+ })
29
31
 
30
- expect(matches).toEqual(['stream', 'maters'])
31
- })
32
+ xit("does not detect anagram subsets", () => {
33
+ const subject = new Anagram("good")
34
+ const matches = subject.matches(...['dog', 'goody'])
32
35
 
33
- xit("does not detect anagram subsets", () => {
34
- const subject = new Anagram("good")
35
- const matches = subject.matches(...['dog', 'goody'])
36
+ expect(matches).toEqual([])
37
+ })
36
38
 
37
- expect(matches).toEqual([])
38
- })
39
+ xit("detects anagram", () => {
40
+ const subject = new Anagram("listen")
41
+ const matches = subject.matches(...['enlists', 'google', 'inlets', 'banana'])
39
42
 
40
- xit("detects anagram", () => {
41
- const subject = new Anagram("listen")
42
- const matches = subject.matches(...['enlists', 'google', 'inlets', 'banana'])
43
+ expect(matches).toEqual(['inlets'])
44
+ })
43
45
 
44
- expect(matches).toEqual(['inlets'])
45
- })
46
+ xit("detects multiple anagrams", () => {
47
+ const subject = new Anagram("allergy")
48
+ const matches = subject.matches(...['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading'])
46
49
 
47
- xit("detects multiple anagrams", () => {
48
- const subject = new Anagram("allergy")
49
- const matches = subject.matches(...['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading'])
50
+ expect(matches).toEqual(['gallery', 'regally', 'largely'])
51
+ })
50
52
 
51
- expect(matches).toEqual(['gallery', 'regally', 'largely'])
52
- })
53
+ xit("detects anagrams case-insensitively", () => {
54
+ const subject = new Anagram("Orchestra")
55
+ const matches = subject.matches(...['cashregister', 'Carthorse', 'radishes'])
53
56
 
54
- xit("detects anagrams case-insensitively", () => {
55
- const subject = new Anagram("Orchestra")
56
- const matches = subject.matches(...['cashregister', 'Carthorse', 'radishes'])
57
+ expect(matches).toEqual(['Carthorse'])
58
+ })
57
59
 
58
- expect(matches).toEqual(['Carthorse'])
59
- })
60
+ xit("does not detect a word as its own anagram", () => {
61
+ const subject = new Anagram("banana")
62
+ const matches = subject.matches(...['Banana'])
60
63
 
61
- xit("does not detect a word as its own anagram", () => {
62
- const subject = new Anagram("banana")
63
- const matches = subject.matches(...['Banana'])
64
+ expect(matches).toEqual([])
65
+ })
64
66
 
65
- expect(matches).toEqual([])
66
- })
67
+ xit("matches() accepts string arguments", () => {
68
+ const subject = new Anagram("ant")
69
+ const matches = subject.matches("stand", "tan", "at")
67
70
 
68
- xit("matches() accepts string arguments", () => {
69
- const subject = new Anagram("ant")
70
- const matches = subject.matches("stand", "tan", "at")
71
+ expect(matches).toEqual(["tan"])
72
+ })
71
73
 
72
- expect(matches).toEqual(["tan"])
73
- })
74
-
75
- xit("matches() accepts single string argument", () => {
76
- const subject = new Anagram("ant")
77
- const matches = subject.matches("tan")
78
-
79
- expect(matches).toEqual(["tan"])
80
- })
74
+ xit("matches() accepts single string argument", () => {
75
+ const subject = new Anagram("ant")
76
+ const matches = subject.matches("tan")
81
77
 
78
+ expect(matches).toEqual(["tan"])
79
+ })
82
80
  })
@@ -1,5 +0,0 @@
1
- export default class Anagram {
2
- public matches(...input: string[]): string[] {
3
- return []
4
- }
5
- }
@@ -0,0 +1,102 @@
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
+ ## Setup
73
+
74
+ Go through the setup instructions for TypeScript to
75
+ install the necessary dependencies:
76
+
77
+ http://exercism.io/languages/typescript
78
+
79
+ ## Requirements
80
+
81
+ Install assignment dependencies:
82
+
83
+ ```bash
84
+ $ yarn install
85
+ ```
86
+
87
+ ## Making the test suite pass
88
+
89
+ Execute the tests with:
90
+
91
+ ```bash
92
+ $ yarn test
93
+ ```
94
+
95
+
96
+
97
+ ## Source
98
+
99
+ 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)
100
+
101
+ ## Submitting Incomplete Solutions
102
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,59 @@
1
+ export default class Square {
2
+ input: string
3
+
4
+ constructor(input: string) {
5
+ this.input = input
6
+ }
7
+
8
+ normalizePlaintext(): string {
9
+ return this.input.toLowerCase().replace(/[^a-zA-Z0-9]/g, '')
10
+ }
11
+
12
+ size() {
13
+ const realLength = Math.sqrt(this.normalizePlaintext().length)
14
+ return Math.ceil(realLength)
15
+ }
16
+
17
+ plaintextSegments() {
18
+ const plainText = this.normalizePlaintext()
19
+ const chunkSize = this.size()
20
+
21
+ const splitRegex = new RegExp(`.{1,${chunkSize}}`, 'g')
22
+ return plainText.match(splitRegex)
23
+ }
24
+
25
+ ciphertext() {
26
+ const textSegments = this.plaintextSegments()
27
+ let i
28
+ let j
29
+ // tslint:disable-next-line: no-any
30
+ const columns: any[] = []
31
+ let currentSegment
32
+ let currentLetter
33
+
34
+ for (i = 0; i < this.size(); i++) {
35
+ columns.push([])
36
+ }
37
+
38
+ for (i = 0; i < textSegments!.length; i++) {
39
+ currentSegment = textSegments![i]
40
+
41
+ for (j = 0; j < currentSegment.length; j++) {
42
+ currentLetter = currentSegment[j]
43
+ columns[j].push(currentLetter)
44
+ }
45
+ }
46
+
47
+ for (i = 0; i < columns.length; i++) {
48
+ columns[i] = columns[i].join('')
49
+ }
50
+
51
+ return columns.join('')
52
+ }
53
+
54
+ normalizeCiphertext() {
55
+ const chunkSize = this.size()
56
+ const splitRegex = new RegExp(`.{1,${chunkSize}}`, 'g')
57
+ return this.ciphertext().match(splitRegex)!.join(' ')
58
+ }
59
+ }
@@ -0,0 +1,53 @@
1
+ import Crypto from './crypto-square'
2
+
3
+ describe('Crypto', () => {
4
+ it('normalize strange characters', () => {
5
+ const crypto = new Crypto('s#$%^&plunk')
6
+ expect(crypto.normalizePlaintext()).toEqual('splunk')
7
+ })
8
+
9
+ xit('normalize numbers', () => {
10
+ const crypto = new Crypto('1, 2, 3 GO!')
11
+ expect(crypto.normalizePlaintext()).toEqual('123go')
12
+ })
13
+
14
+ xit('size of small square', () => {
15
+ const crypto = new Crypto('1234')
16
+ expect(crypto.size()).toEqual(2)
17
+ })
18
+
19
+ xit('size of small square with additional non-number chars', () => {
20
+ const crypto = new Crypto('1 2 3 4')
21
+ expect(crypto.size()).toEqual(2)
22
+ })
23
+
24
+ xit('size of slightly larger square', () => {
25
+ const crypto = new Crypto('123456789')
26
+ expect(crypto.size()).toEqual(3)
27
+ })
28
+
29
+ xit('size of non-perfect square', () => {
30
+ const crypto = new Crypto('123456789abc')
31
+ expect(crypto.size()).toEqual(4)
32
+ })
33
+
34
+ xit('plain text segments', () => {
35
+ const crypto = new Crypto('Never vex thine heart with idle woes')
36
+ expect(crypto.plaintextSegments()).toEqual(['neverv', 'exthin', 'eheart', 'withid', 'lewoes'])
37
+ })
38
+
39
+ xit('plain text segments', () => {
40
+ const crypto = new Crypto('ZOMG! ZOMBIES!!!')
41
+ expect(crypto.plaintextSegments()).toEqual(['zomg', 'zomb', 'ies'])
42
+ })
43
+
44
+ xit('cipher text', () => {
45
+ const crypto = new Crypto('Time is an illusion. Lunchtime doubly so.')
46
+ expect(crypto.ciphertext()).toEqual('tasneyinicdsmiohooelntuillibsuuml')
47
+ })
48
+
49
+ xit('cipher text', () => {
50
+ const crypto = new Crypto('We all know interspecies romance is weird.')
51
+ expect(crypto.ciphertext()).toEqual('wneiaweoreneawssciliprerlneoidktcms')
52
+ })
53
+ })
@@ -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,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
+ }