trackler 2.2.1.61 → 2.2.1.62
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/forth/canonical-data.json +1 -7
- data/problem-specifications/exercises/meetup/description.md +16 -12
- data/problem-specifications/exercises/sum-of-multiples/description.md +3 -3
- data/tracks/c/config.json +14 -1
- data/tracks/c/exercises/anagram/src/anagram.h +19 -4
- data/tracks/c/exercises/anagram/src/example.c +27 -40
- data/tracks/c/exercises/anagram/test/test_anagram.c +100 -152
- data/tracks/c/exercises/sublist/README.md +53 -0
- data/tracks/c/exercises/sublist/makefile +15 -0
- data/tracks/c/exercises/sublist/src/example.c +63 -0
- data/tracks/c/exercises/sublist/src/sublist.h +17 -0
- data/tracks/c/exercises/sublist/test/test_sublist.c +243 -0
- data/tracks/c/exercises/sublist/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/sublist/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/sublist/test/vendor/unity_internals.h +701 -0
- data/tracks/ecmascript/config.json +56 -0
- data/tracks/ecmascript/exercises/rectangles/README.md +95 -0
- data/tracks/ecmascript/exercises/rectangles/example.js +38 -0
- data/tracks/ecmascript/exercises/rectangles/package.json +72 -0
- data/tracks/ecmascript/exercises/rectangles/rectangles.spec.js +147 -0
- data/tracks/ecmascript/exercises/rotational-cipher/README.md +66 -0
- data/tracks/ecmascript/exercises/rotational-cipher/example.js +16 -0
- data/tracks/ecmascript/exercises/rotational-cipher/package.json +72 -0
- data/tracks/ecmascript/exercises/rotational-cipher/rotational-cipher.spec.js +73 -0
- data/tracks/ecmascript/exercises/spiral-matrix/README.md +59 -0
- data/tracks/ecmascript/exercises/spiral-matrix/example.js +26 -0
- data/tracks/ecmascript/exercises/spiral-matrix/package.json +72 -0
- data/tracks/ecmascript/exercises/spiral-matrix/spiral-matrix.spec.js +55 -0
- data/tracks/ecmascript/exercises/transpose/README.md +94 -0
- data/tracks/ecmascript/exercises/transpose/example.js +12 -0
- data/tracks/ecmascript/exercises/transpose/package.json +71 -0
- data/tracks/ecmascript/exercises/transpose/transpose.spec.js +121 -0
- data/tracks/go/exercises/allergies/.meta/gen.go +88 -0
- data/tracks/go/exercises/allergies/allergies_test.go +19 -46
- data/tracks/go/exercises/allergies/cases_test.go +60 -0
- data/tracks/go/exercises/bob/bob.go +0 -2
- data/tracks/go/exercises/forth/cases_test.go +2 -7
- data/tracks/go/exercises/nucleotide-count/nucleotide_count.go +0 -2
- data/tracks/go/exercises/pangram/.meta/gen.go +54 -0
- data/tracks/go/exercises/pangram/cases_test.go +62 -0
- data/tracks/go/exercises/pangram/example.go +3 -5
- data/tracks/go/exercises/pangram/pangram_test.go +3 -24
- data/tracks/go/exercises/rna-transcription/rna_transcription.go +0 -2
- data/tracks/go/exercises/robot-name/bonus_example.go +0 -2
- data/tracks/java/exercises/acronym/.meta/src/reference/java/Acronym.java +3 -3
- data/tracks/lfe/config.json +4 -3
- data/tracks/perl6/docs/SNIPPET.txt +8 -3
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/allergies.t +10 -2
- data/tracks/perl6/exercises/allergies/example.yaml +10 -2
- data/tracks/perl6/exercises/leap/Example.pm6 +1 -1
- data/tracks/perl6/exercises/leap/Leap.pm6 +1 -1
- data/tracks/perl6/exercises/leap/example.yaml +10 -2
- data/tracks/perl6/exercises/leap/leap.t +10 -2
- data/tracks/perl6/exercises/luhn/Example.pm6 +1 -1
- data/tracks/perl6/exercises/luhn/Luhn.pm6 +1 -1
- data/tracks/perl6/exercises/luhn/example.yaml +10 -2
- data/tracks/perl6/exercises/luhn/luhn.t +10 -2
- data/tracks/perl6/exercises/pangram/Example.pm6 +1 -1
- data/tracks/perl6/exercises/pangram/Pangram.pm6 +1 -1
- data/tracks/perl6/exercises/pangram/example.yaml +12 -6
- data/tracks/perl6/exercises/pangram/pangram.t +9 -3
- data/tracks/python/config.json +38 -0
- data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +81 -66
- data/tracks/python/exercises/connect/README.md +44 -0
- data/tracks/python/exercises/connect/connect.py +7 -0
- data/tracks/python/exercises/connect/connect_test.py +118 -0
- data/tracks/python/exercises/connect/example.py +61 -0
- data/tracks/python/exercises/go-counting/README.md +44 -0
- data/tracks/python/exercises/go-counting/example.py +62 -0
- data/tracks/python/exercises/go-counting/go_counting.py +38 -0
- data/tracks/python/exercises/go-counting/go_counting_test.py +92 -0
- data/tracks/python/exercises/parallel-letter-frequency/README.md +24 -0
- data/tracks/python/exercises/parallel-letter-frequency/example.py +56 -0
- data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency.py +2 -0
- data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency_test.py +61 -0
- data/tracks/python/exercises/strain/README.md +3 -1
- data/tracks/python/exercises/strain/strain.py +2 -2
- data/tracks/rust/.travis.yml +1 -0
- data/tracks/rust/README.md +2 -0
- data/tracks/rust/_test/check-exercises.sh +41 -54
- data/tracks/rust/_test/ensure-readmes-are-updated.sh +40 -0
- data/tracks/rust/bin/test-exercise +84 -0
- data/tracks/rust/exercises/alphametics/.meta/test-in-release-mode +2 -0
- data/tracks/rust/exercises/alphametics/src/lib.rs +1 -1
- data/tracks/rust/exercises/dominoes/README.md +3 -3
- data/tracks/rust/exercises/isbn-verifier/README.md +3 -2
- data/tracks/rust/exercises/nucleotide-count/README.md +2 -2
- data/tracks/rust/exercises/perfect-numbers/src/lib.rs +10 -0
- data/tracks/rust/exercises/phone-number/README.md +1 -1
- data/tracks/rust/exercises/pythagorean-triplet/src/lib.rs +3 -0
- data/tracks/rust/exercises/rectangles/README.md +9 -9
- data/tracks/rust/exercises/two-bucket/README.md +7 -7
- data/tracks/typescript/config.json +16 -0
- data/tracks/typescript/exercises/diamond/README.md +84 -0
- data/tracks/typescript/exercises/diamond/diamond.example.ts +51 -0
- data/tracks/typescript/exercises/diamond/diamond.test.ts +35 -0
- data/tracks/typescript/exercises/diamond/diamond.ts +0 -0
- data/tracks/typescript/exercises/diamond/package.json +36 -0
- data/tracks/typescript/exercises/diamond/tsconfig.json +22 -0
- data/tracks/typescript/exercises/diamond/tslint.json +127 -0
- data/tracks/typescript/exercises/diamond/yarn.lock +2624 -0
- metadata +53 -2
@@ -1170,6 +1170,21 @@
|
|
1170
1170
|
"regular_expressions"
|
1171
1171
|
]
|
1172
1172
|
},
|
1173
|
+
{
|
1174
|
+
"uuid": "9c140fb7-cc8b-411b-b613-a0e0081a9c3f",
|
1175
|
+
"slug": "transpose",
|
1176
|
+
"core": false,
|
1177
|
+
"unlocked_by": "matrix",
|
1178
|
+
"difficulty": 1,
|
1179
|
+
"topics": [
|
1180
|
+
"loops",
|
1181
|
+
"arrays",
|
1182
|
+
"lists",
|
1183
|
+
"matrices",
|
1184
|
+
"strings",
|
1185
|
+
"text_formatting"
|
1186
|
+
]
|
1187
|
+
},
|
1173
1188
|
{
|
1174
1189
|
"uuid": "775ae0ec-8db7-4568-a188-963931cf5ee1",
|
1175
1190
|
"slug": "protein-translation",
|
@@ -1182,6 +1197,47 @@
|
|
1182
1197
|
"strings",
|
1183
1198
|
"algorithms"
|
1184
1199
|
]
|
1200
|
+
},
|
1201
|
+
{
|
1202
|
+
"uuid": "eec93b8b-0b50-3380-bd75-c53210c48ac5bffc8af",
|
1203
|
+
"slug": "spiral-matrix",
|
1204
|
+
"core": false,
|
1205
|
+
"unlocked_by": "matrix",
|
1206
|
+
"difficulty": 4,
|
1207
|
+
"topics": [
|
1208
|
+
"Control-flow (conditionals)",
|
1209
|
+
"Control-flow (loops)",
|
1210
|
+
"Data structures",
|
1211
|
+
"Arrays",
|
1212
|
+
"Matrices"
|
1213
|
+
]
|
1214
|
+
},
|
1215
|
+
{
|
1216
|
+
"uuid": "a7277814-0582-ce80-6451-7352158be58a36d5c3d",
|
1217
|
+
"slug": "rectangles",
|
1218
|
+
"core": false,
|
1219
|
+
"unlocked_by": "matrix",
|
1220
|
+
"difficulty": 4,
|
1221
|
+
"topics": [
|
1222
|
+
"Control-flow (conditionals)",
|
1223
|
+
"Control-flow (loops)",
|
1224
|
+
"Arrays",
|
1225
|
+
"Matrices",
|
1226
|
+
"Strings"
|
1227
|
+
]
|
1228
|
+
},
|
1229
|
+
{
|
1230
|
+
"uuid": "28d75cd0-0ab4-ed80-6010-6a0a9b61a3388455777",
|
1231
|
+
"slug": "rotational-cipher",
|
1232
|
+
"core": false,
|
1233
|
+
"unlocked_by": "simple-cipher",
|
1234
|
+
"difficulty": 2,
|
1235
|
+
"topics": [
|
1236
|
+
"Control-flow (conditionals)",
|
1237
|
+
"Strings",
|
1238
|
+
"Text formatting",
|
1239
|
+
"Transforming"
|
1240
|
+
]
|
1185
1241
|
}
|
1186
1242
|
],
|
1187
1243
|
"foregone": []
|
@@ -0,0 +1,95 @@
|
|
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 ECMAScript to
|
69
|
+
install the necessary dependencies:
|
70
|
+
|
71
|
+
http://exercism.io/languages/ecmascript/installation
|
72
|
+
|
73
|
+
## Requirements
|
74
|
+
|
75
|
+
Install assignment dependencies:
|
76
|
+
|
77
|
+
```bash
|
78
|
+
$ npm install
|
79
|
+
```
|
80
|
+
|
81
|
+
## Making the test suite pass
|
82
|
+
|
83
|
+
Execute the tests with:
|
84
|
+
|
85
|
+
```bash
|
86
|
+
$ npm test
|
87
|
+
```
|
88
|
+
|
89
|
+
In the test suites all tests but the first have been skipped.
|
90
|
+
|
91
|
+
Once you get a test passing, you can enable the next one by
|
92
|
+
changing `xtest` to `test`.
|
93
|
+
|
94
|
+
## Submitting Incomplete Solutions
|
95
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Rectangles {
|
2
|
+
|
3
|
+
static count(diagram) {
|
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++) if (!'+-'.includes(diagram[y].charAt(s))) validRectangle = false;
|
22
|
+
for (let s = x + 1; s < i; s++) if (!'+-'.includes(diagram[j].charAt(s))) validRectangle = false;
|
23
|
+
for (let t = y + 1; t < j; t++) if (!'+|'.includes(diagram[t].charAt(x))) validRectangle = false;
|
24
|
+
for (let t = y + 1; t < j; t++) if (!'+|'.includes(diagram[t].charAt(i))) validRectangle = false;
|
25
|
+
|
26
|
+
if (validRectangle) rectangles++;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
return rectangles;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
export default Rectangles;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
{
|
2
|
+
"name": "xecmascript",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"description": "Exercism exercises in ECMAScript 6.",
|
5
|
+
"author": "Katrina Owen",
|
6
|
+
"private": true,
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/exercism/xecmascript"
|
10
|
+
},
|
11
|
+
"devDependencies": {
|
12
|
+
"babel-jest": "^21.2.0",
|
13
|
+
"babel-plugin-transform-builtin-extend": "^1.1.2",
|
14
|
+
"babel-preset-env": "^1.4.0",
|
15
|
+
"eslint": "^3.19.0",
|
16
|
+
"eslint-config-airbnb": "^15.0.1",
|
17
|
+
"eslint-plugin-import": "^2.2.0",
|
18
|
+
"eslint-plugin-jsx-a11y": "^5.0.1",
|
19
|
+
"eslint-plugin-react": "^7.0.1",
|
20
|
+
"jest": "^21.2.1"
|
21
|
+
},
|
22
|
+
"jest": {
|
23
|
+
"modulePathIgnorePatterns": [
|
24
|
+
"package.json"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
"babel": {
|
28
|
+
"presets": [
|
29
|
+
"env"
|
30
|
+
],
|
31
|
+
"plugins": [
|
32
|
+
[
|
33
|
+
"babel-plugin-transform-builtin-extend",
|
34
|
+
{
|
35
|
+
"globals": [
|
36
|
+
"Error"
|
37
|
+
]
|
38
|
+
}
|
39
|
+
],
|
40
|
+
[
|
41
|
+
"transform-regenerator"
|
42
|
+
]
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"scripts": {
|
46
|
+
"test": "jest --no-cache ./*",
|
47
|
+
"watch": "jest --no-cache --watch ./*",
|
48
|
+
"lint": "eslint .",
|
49
|
+
"lint-test": "eslint . && jest --no-cache ./* "
|
50
|
+
},
|
51
|
+
"eslintConfig": {
|
52
|
+
"parserOptions": {
|
53
|
+
"ecmaVersion": 6,
|
54
|
+
"sourceType": "module"
|
55
|
+
},
|
56
|
+
"env": {
|
57
|
+
"es6": true,
|
58
|
+
"node": true,
|
59
|
+
"jest": true
|
60
|
+
},
|
61
|
+
"extends": "airbnb",
|
62
|
+
"rules": {
|
63
|
+
"import/no-unresolved": "off",
|
64
|
+
"import/extensions": "off",
|
65
|
+
"no-plusplus": "off"
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"licenses": [
|
69
|
+
"MIT"
|
70
|
+
],
|
71
|
+
"dependencies": {}
|
72
|
+
}
|
@@ -0,0 +1,147 @@
|
|
1
|
+
import Rectangles from './rectangles.js';
|
2
|
+
|
3
|
+
describe('Rectangles', () => {
|
4
|
+
test('no rows', () => {
|
5
|
+
const expected = 0;
|
6
|
+
const actual = Rectangles.count([]);
|
7
|
+
|
8
|
+
expect(actual).toEqual(expected);
|
9
|
+
});
|
10
|
+
|
11
|
+
xtest('no columns', () => {
|
12
|
+
const expected = 0;
|
13
|
+
const actual = Rectangles.count(['']);
|
14
|
+
|
15
|
+
expect(actual).toEqual(expected);
|
16
|
+
});
|
17
|
+
|
18
|
+
xtest('no rectangles', () => {
|
19
|
+
const expected = 0;
|
20
|
+
const actual = Rectangles.count([' ']);
|
21
|
+
|
22
|
+
expect(actual).toEqual(expected);
|
23
|
+
});
|
24
|
+
|
25
|
+
xtest('one rectangle', () => {
|
26
|
+
const expected = 1;
|
27
|
+
const actual = Rectangles.count([
|
28
|
+
'+-+',
|
29
|
+
'| |',
|
30
|
+
'+-+',
|
31
|
+
]);
|
32
|
+
|
33
|
+
expect(actual).toEqual(expected);
|
34
|
+
});
|
35
|
+
|
36
|
+
xtest('two rectangles without shared parts', () => {
|
37
|
+
const expected = 2;
|
38
|
+
const actual = Rectangles.count([
|
39
|
+
' +-+',
|
40
|
+
' | |',
|
41
|
+
'+-+-+',
|
42
|
+
'| | ',
|
43
|
+
'+-+ ',
|
44
|
+
]);
|
45
|
+
|
46
|
+
expect(actual).toEqual(expected);
|
47
|
+
});
|
48
|
+
|
49
|
+
xtest('five rectangles with shared parts', () => {
|
50
|
+
const expected = 5;
|
51
|
+
const actual = Rectangles.count([
|
52
|
+
' +-+',
|
53
|
+
' | |',
|
54
|
+
'+-+-+',
|
55
|
+
'| | |',
|
56
|
+
'+-+-+',
|
57
|
+
]);
|
58
|
+
|
59
|
+
expect(actual).toEqual(expected);
|
60
|
+
});
|
61
|
+
|
62
|
+
xtest('rectangle of height 1 is counted', () => {
|
63
|
+
const expected = 1;
|
64
|
+
const actual = Rectangles.count([
|
65
|
+
'+--+',
|
66
|
+
'+--+',
|
67
|
+
]);
|
68
|
+
|
69
|
+
expect(actual).toEqual(expected);
|
70
|
+
});
|
71
|
+
|
72
|
+
xtest('rectangle of width 1 is counted', () => {
|
73
|
+
const expected = 1;
|
74
|
+
const actual = Rectangles.count([
|
75
|
+
'++',
|
76
|
+
'||',
|
77
|
+
'++',
|
78
|
+
]);
|
79
|
+
|
80
|
+
expect(actual).toEqual(expected);
|
81
|
+
});
|
82
|
+
|
83
|
+
xtest('1x1 square is counted', () => {
|
84
|
+
const expected = 1;
|
85
|
+
const actual = Rectangles.count([
|
86
|
+
'++',
|
87
|
+
'++',
|
88
|
+
]);
|
89
|
+
|
90
|
+
expect(actual).toEqual(expected);
|
91
|
+
});
|
92
|
+
|
93
|
+
xtest('only complete rectangles are counted', () => {
|
94
|
+
const expected = 1;
|
95
|
+
const actual = Rectangles.count([
|
96
|
+
' +-+',
|
97
|
+
' |',
|
98
|
+
'+-+-+',
|
99
|
+
'| | -',
|
100
|
+
'+-+-+',
|
101
|
+
]);
|
102
|
+
|
103
|
+
expect(actual).toEqual(expected);
|
104
|
+
});
|
105
|
+
|
106
|
+
xtest('rectangles can be of different sizes', () => {
|
107
|
+
const expected = 3;
|
108
|
+
const actual = Rectangles.count([
|
109
|
+
'+------+----+',
|
110
|
+
'| | |',
|
111
|
+
'+---+--+ |',
|
112
|
+
'| | |',
|
113
|
+
'+---+-------+',
|
114
|
+
]);
|
115
|
+
|
116
|
+
expect(actual).toEqual(expected);
|
117
|
+
});
|
118
|
+
|
119
|
+
xtest('corner is required for a rectangle to be complete', () => {
|
120
|
+
const expected = 2;
|
121
|
+
const actual = Rectangles.count([
|
122
|
+
'+------+----+',
|
123
|
+
'| | |',
|
124
|
+
'+------+ |',
|
125
|
+
'| | |',
|
126
|
+
'+---+-------+',
|
127
|
+
]);
|
128
|
+
|
129
|
+
expect(actual).toEqual(expected);
|
130
|
+
});
|
131
|
+
|
132
|
+
xtest('large input with many rectangles', () => {
|
133
|
+
const expected = 60;
|
134
|
+
const actual = Rectangles.count([
|
135
|
+
'+---+--+----+',
|
136
|
+
'| +--+----+',
|
137
|
+
'+---+--+ |',
|
138
|
+
'| +--+----+',
|
139
|
+
'+---+--+--+-+',
|
140
|
+
'+---+--+--+-+',
|
141
|
+
'+------+ | |',
|
142
|
+
' +-+',
|
143
|
+
]);
|
144
|
+
|
145
|
+
expect(actual).toEqual(expected);
|
146
|
+
});
|
147
|
+
});
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Rotational cipher
|
2
|
+
|
3
|
+
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
|
4
|
+
|
5
|
+
The Caesar cipher is a simple shift cipher that relies on
|
6
|
+
transposing all the letters in the alphabet using an integer key
|
7
|
+
between `0` and `26`. Using a key of `0` or `26` will always yield
|
8
|
+
the same output due to modular arithmetic. The letter is shifted
|
9
|
+
for as many values as the value of the key.
|
10
|
+
|
11
|
+
The general notation for rotational ciphers is `ROT + <key>`.
|
12
|
+
The most commonly used rotational cipher is `ROT13`.
|
13
|
+
|
14
|
+
A `ROT13` on the Latin alphabet would be as follows:
|
15
|
+
|
16
|
+
```text
|
17
|
+
Plain: abcdefghijklmnopqrstuvwxyz
|
18
|
+
Cipher: nopqrstuvwxyzabcdefghijklm
|
19
|
+
```
|
20
|
+
|
21
|
+
It is stronger than the Atbash cipher because it has 27 possible keys, and 25 usable keys.
|
22
|
+
|
23
|
+
Ciphertext is written out in the same formatting as the input including spaces and punctuation.
|
24
|
+
|
25
|
+
## Examples
|
26
|
+
|
27
|
+
- ROT5 `omg` gives `trl`
|
28
|
+
- ROT0 `c` gives `c`
|
29
|
+
- ROT26 `Cool` gives `Cool`
|
30
|
+
- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.`
|
31
|
+
- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.`
|
32
|
+
|
33
|
+
## Setup
|
34
|
+
|
35
|
+
Go through the setup instructions for ECMAScript to
|
36
|
+
install the necessary dependencies:
|
37
|
+
|
38
|
+
http://exercism.io/languages/ecmascript/installation
|
39
|
+
|
40
|
+
## Requirements
|
41
|
+
|
42
|
+
Install assignment dependencies:
|
43
|
+
|
44
|
+
```bash
|
45
|
+
$ npm install
|
46
|
+
```
|
47
|
+
|
48
|
+
## Making the test suite pass
|
49
|
+
|
50
|
+
Execute the tests with:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
$ npm test
|
54
|
+
```
|
55
|
+
|
56
|
+
In the test suites all tests but the first have been skipped.
|
57
|
+
|
58
|
+
Once you get a test passing, you can enable the next one by
|
59
|
+
changing `xtest` to `test`.
|
60
|
+
|
61
|
+
## Source
|
62
|
+
|
63
|
+
Wikipedia [https://en.wikipedia.org/wiki/Caesar_cipher](https://en.wikipedia.org/wiki/Caesar_cipher)
|
64
|
+
|
65
|
+
## Submitting Incomplete Solutions
|
66
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|