trackler 2.2.1.16 → 2.2.1.17
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/tracks/delphi/config/maintainers.json +1 -1
- data/tracks/objective-c/docs/SNIPPET.txt +10 -0
- data/tracks/python/.gitignore +1 -0
- data/tracks/python/exercises/accumulate/accumulate.py +1 -1
- data/tracks/python/exercises/allergies/allergies.py +9 -1
- data/tracks/python/exercises/alphametics/alphametics.py +1 -1
- data/tracks/python/exercises/anagram/anagram.py +1 -1
- data/tracks/python/exercises/atbash-cipher/atbash_cipher.py +2 -2
- data/tracks/python/exercises/beer-song/beer_song.py +2 -2
- data/tracks/python/exercises/binary/binary.py +1 -1
- data/tracks/python/exercises/binary-search/binary_search.py +1 -1
- data/tracks/python/exercises/bob/bob.py +1 -1
- data/tracks/python/exercises/book-store/book_store.py +1 -1
- data/tracks/python/exercises/bracket-push/bracket_push.py +1 -1
- data/tracks/python/requirements-travis.txt +1 -1
- data/tracks/rust/config.json +21 -7
- data/tracks/rust/exercises/crypto-square/.gitignore +7 -0
- data/tracks/rust/exercises/crypto-square/Cargo-example.toml +7 -0
- data/tracks/rust/exercises/crypto-square/Cargo.toml +6 -0
- data/tracks/rust/exercises/crypto-square/README.md +106 -0
- data/tracks/rust/exercises/crypto-square/example.rs +114 -0
- data/tracks/rust/exercises/crypto-square/src/lib.rs +3 -0
- data/tracks/rust/exercises/crypto-square/tests/crypto-square.rs +81 -0
- data/tracks/sml/Makefile +1 -1
- data/tracks/sml/config.json +30 -0
- data/tracks/sml/exercises/atbash-cipher/README.md +64 -0
- data/tracks/sml/exercises/atbash-cipher/atbash-cipher.sml +5 -0
- data/tracks/sml/exercises/atbash-cipher/example.sml +32 -0
- data/tracks/sml/exercises/atbash-cipher/test.sml +52 -0
- data/tracks/sml/exercises/atbash-cipher/testlib.sml +159 -0
- data/tracks/sml/exercises/pangram/README.md +45 -0
- data/tracks/sml/exercises/pangram/example.sml +18 -0
- data/tracks/sml/exercises/pangram/pangram.sml +2 -0
- data/tracks/sml/exercises/pangram/test.sml +41 -0
- data/tracks/sml/exercises/pangram/testlib.sml +159 -0
- data/tracks/sml/exercises/perfect-numbers/README.md +54 -0
- data/tracks/sml/exercises/perfect-numbers/example.sml +26 -0
- data/tracks/sml/exercises/perfect-numbers/perfect-numbers.sml +6 -0
- data/tracks/sml/exercises/perfect-numbers/test.sml +59 -0
- data/tracks/sml/exercises/perfect-numbers/testlib.sml +159 -0
- metadata +24 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d633f439c412c8de9275558a71e556144c1064db
|
4
|
+
data.tar.gz: b6706bedaa2ed4c7ff5137e3efbba8566e595312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ec9f885ae035b45571c86c1124867641e68cd97f2ee20e20ca570874501f9ce416897c2115e15cd9522a0ea29b36e2053e593a3a719d421086af90028965b5
|
7
|
+
data.tar.gz: 8a2a82e332e0cd1c7cfc6b8862f705163c21b28560c2a7548940e472dccfc541cb3c34296f09731ec7ac39cbaf83078522a02187b5351f172756ee6671fb6b99
|
data/lib/trackler/version.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"show_on_website": true,
|
16
16
|
"alumnus": false,
|
17
17
|
"name": "Ryan Potts",
|
18
|
-
"bio": "I have been using Delphi professionally since 1996, Delphi 1. At my day job I
|
18
|
+
"bio": "I have been using Delphi professionally since 1996, Delphi 1. At my day job I develop software used in the control of various types of test machines used by the auto industry. Exercism is my first real push into Open Source and I'm happy to have this opportunity to teach and share the virtures of Delphi with others.",
|
19
19
|
"link_text": null,
|
20
20
|
"link_url": null,
|
21
21
|
"avatar_url": null
|
data/tracks/python/.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
def accumulate():
|
1
|
+
def accumulate(array, function):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def solve():
|
1
|
+
def solve(string):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def detect_anagrams():
|
1
|
+
def detect_anagrams(string, array):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def parse_binary():
|
1
|
+
def parse_binary(string):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def binary_search():
|
1
|
+
def binary_search(array, number):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def hey():
|
1
|
+
def hey(string):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def calculate_total():
|
1
|
+
def calculate_total(array, number=None):
|
2
2
|
pass
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def check_brackets():
|
1
|
+
def check_brackets(string):
|
2
2
|
pass
|
data/tracks/rust/config.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
"difficulty": 1,
|
22
22
|
"topics": [
|
23
23
|
"crates",
|
24
|
-
"
|
24
|
+
"mathematics"
|
25
25
|
]
|
26
26
|
},
|
27
27
|
{
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"unlocked_by": null,
|
32
32
|
"difficulty": 1,
|
33
33
|
"topics": [
|
34
|
-
"
|
34
|
+
"mathematics",
|
35
35
|
"booleans",
|
36
36
|
"conditionals"
|
37
37
|
]
|
@@ -119,7 +119,7 @@
|
|
119
119
|
"unlocked_by": null,
|
120
120
|
"difficulty": 1,
|
121
121
|
"topics": [
|
122
|
-
"
|
122
|
+
"mathematics",
|
123
123
|
"panic"
|
124
124
|
]
|
125
125
|
},
|
@@ -140,7 +140,7 @@
|
|
140
140
|
"unlocked_by": null,
|
141
141
|
"difficulty": 1,
|
142
142
|
"topics": [
|
143
|
-
"
|
143
|
+
"mathematics"
|
144
144
|
]
|
145
145
|
},
|
146
146
|
{
|
@@ -196,7 +196,7 @@
|
|
196
196
|
"unlocked_by": null,
|
197
197
|
"difficulty": 4,
|
198
198
|
"topics": [
|
199
|
-
"
|
199
|
+
"Mathematics",
|
200
200
|
"Vec",
|
201
201
|
"Index (optional)"
|
202
202
|
]
|
@@ -289,6 +289,20 @@
|
|
289
289
|
"ascii"
|
290
290
|
]
|
291
291
|
},
|
292
|
+
{
|
293
|
+
"uuid": "0cc485e9-43ba-4d97-a622-ee4cb8b9f1f7",
|
294
|
+
"slug": "crypto-square",
|
295
|
+
"difficulty": 4,
|
296
|
+
"topics": [
|
297
|
+
"str vs string",
|
298
|
+
"primitive types",
|
299
|
+
"iterators",
|
300
|
+
"chars",
|
301
|
+
"arrays",
|
302
|
+
"ascii",
|
303
|
+
"transforming"
|
304
|
+
]
|
305
|
+
},
|
292
306
|
{
|
293
307
|
"uuid": "5dbecc83-2c8d-467d-be05-f28a08f7abcf",
|
294
308
|
"slug": "rotational-cipher",
|
@@ -369,7 +383,7 @@
|
|
369
383
|
"unlocked_by": null,
|
370
384
|
"difficulty": 4,
|
371
385
|
"topics": [
|
372
|
-
"
|
386
|
+
"Mathematics",
|
373
387
|
"Struct"
|
374
388
|
]
|
375
389
|
},
|
@@ -596,7 +610,7 @@
|
|
596
610
|
"topics": [
|
597
611
|
"string parsing",
|
598
612
|
"combinations",
|
599
|
-
"
|
613
|
+
"mathematics",
|
600
614
|
"external crates (optional)"
|
601
615
|
]
|
602
616
|
},
|
@@ -0,0 +1,106 @@
|
|
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
|
+
```plain
|
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
|
+
```plain
|
45
|
+
imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
|
46
|
+
```
|
47
|
+
|
48
|
+
Output the encoded text in chunks. Phrases that fill perfect squares
|
49
|
+
`(r X r)` should be output in `r`-length chunks separated by spaces.
|
50
|
+
Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.
|
51
|
+
|
52
|
+
```plain
|
53
|
+
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
|
54
|
+
```
|
55
|
+
|
56
|
+
Notice that were we to stack these, we could visually decode the
|
57
|
+
cyphertext back in to the original message:
|
58
|
+
|
59
|
+
```plain
|
60
|
+
imtgdvs
|
61
|
+
fearwer
|
62
|
+
mayoogo
|
63
|
+
anouuio
|
64
|
+
ntnnlvt
|
65
|
+
wttddes
|
66
|
+
aohghn
|
67
|
+
sseoau
|
68
|
+
```
|
69
|
+
|
70
|
+
## Rust Installation
|
71
|
+
|
72
|
+
Refer to the [exercism help page][help-page] for Rust installation and learning
|
73
|
+
resources.
|
74
|
+
|
75
|
+
## Writing the Code
|
76
|
+
|
77
|
+
Execute the tests with:
|
78
|
+
|
79
|
+
```bash
|
80
|
+
$ cargo test
|
81
|
+
```
|
82
|
+
|
83
|
+
All but the first test have been ignored. After you get the first test to
|
84
|
+
pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
|
85
|
+
to pass again. The test file is located in the `tests` directory. You can
|
86
|
+
also remove the ignore flag from all the tests to get them to run all at once
|
87
|
+
if you wish.
|
88
|
+
|
89
|
+
Make sure to read the [Crates and Modules](https://doc.rust-lang.org/stable/book/crates-and-modules.html) chapter if you
|
90
|
+
haven't already, it will help you with organizing your files.
|
91
|
+
|
92
|
+
## Feedback, Issues, Pull Requests
|
93
|
+
|
94
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
|
95
|
+
|
96
|
+
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
97
|
+
|
98
|
+
[help-page]: http://exercism.io/languages/rust
|
99
|
+
[crates-and-modules]: http://doc.rust-lang.org/stable/book/crates-and-modules.html
|
100
|
+
|
101
|
+
## Source
|
102
|
+
|
103
|
+
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)
|
104
|
+
|
105
|
+
## Submitting Incomplete Solutions
|
106
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,114 @@
|
|
1
|
+
use std::ascii::AsciiExt;
|
2
|
+
|
3
|
+
extern crate itertools;
|
4
|
+
use itertools::Itertools;
|
5
|
+
|
6
|
+
/// Encrypt the input string using square cryptography
|
7
|
+
pub fn encrypt(input: &str) -> String {
|
8
|
+
let prepared = prepare(input);
|
9
|
+
if prepared.len() == 0 {
|
10
|
+
return String::new();
|
11
|
+
}
|
12
|
+
|
13
|
+
let (cols, rows) = dimensions(prepared.len());
|
14
|
+
|
15
|
+
let mut output = String::with_capacity(input.len());
|
16
|
+
for chunk_iterator in SquareIndexer::new(rows, cols).chunks(cols).into_iter() {
|
17
|
+
for ch_idx in chunk_iterator {
|
18
|
+
if ch_idx < prepared.len() {
|
19
|
+
output.push(prepared[ch_idx]);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
output.push(' ');
|
23
|
+
}
|
24
|
+
|
25
|
+
// we know there's one extra space at the end
|
26
|
+
output.pop();
|
27
|
+
|
28
|
+
output
|
29
|
+
}
|
30
|
+
|
31
|
+
/// Construct a vector of characters from the given input.
|
32
|
+
///
|
33
|
+
/// Constrain it to the allowed chars: lowercase ascii letters.
|
34
|
+
/// We construct a vector here because the length of the input
|
35
|
+
/// matters when constructing the output, so we need to know
|
36
|
+
/// how many input chars there are. We could treat it as a stream
|
37
|
+
/// and just stream twice, but collecting it into a vector works
|
38
|
+
/// equally well and might be a bit faster.
|
39
|
+
fn prepare(input: &str) -> Vec<char> {
|
40
|
+
let mut output = Vec::with_capacity(input.len());
|
41
|
+
|
42
|
+
output.extend(
|
43
|
+
input
|
44
|
+
.chars()
|
45
|
+
.filter(|&c| c.is_ascii() && !c.is_whitespace())
|
46
|
+
.map(|c| c.to_ascii_lowercase())
|
47
|
+
.filter(|&c| c >= 'a' && c <= 'z'),
|
48
|
+
);
|
49
|
+
output.shrink_to_fit();
|
50
|
+
|
51
|
+
output
|
52
|
+
}
|
53
|
+
|
54
|
+
/// Get the dimensions of the appropriate bounding rectangle for this encryption
|
55
|
+
///
|
56
|
+
/// To find `(rows, cols)` such that `cols >= rows && cols - rows <= 1`, we find
|
57
|
+
/// the least square greater than or equal to the message length. Its square root
|
58
|
+
/// is the cols. If the message length is a perfect square, `rows` is the same.
|
59
|
+
/// Otherwise, it is one less.
|
60
|
+
fn dimensions(length: usize) -> (usize, usize) {
|
61
|
+
let cols = (length as f64).sqrt().ceil() as usize;
|
62
|
+
let rows = if cols * cols == length {
|
63
|
+
cols
|
64
|
+
} else {
|
65
|
+
cols - 1
|
66
|
+
};
|
67
|
+
(rows, cols)
|
68
|
+
}
|
69
|
+
|
70
|
+
/// Iterator over the indices of the appropriate chars of the output.
|
71
|
+
///
|
72
|
+
/// For a (2, 3) (r, c) grid, yields (0, 3, 1, 4, 2, 5).
|
73
|
+
/// Does no bounds checking or space insertion: that's handled elsewhere.
|
74
|
+
#[derive(Debug)]
|
75
|
+
struct SquareIndexer {
|
76
|
+
rows: usize,
|
77
|
+
cols: usize,
|
78
|
+
cur_row: usize,
|
79
|
+
cur_col: usize,
|
80
|
+
max_value: usize,
|
81
|
+
}
|
82
|
+
|
83
|
+
impl SquareIndexer {
|
84
|
+
fn new(rows: usize, cols: usize) -> SquareIndexer {
|
85
|
+
SquareIndexer {
|
86
|
+
rows: rows,
|
87
|
+
cols: cols,
|
88
|
+
cur_row: 0,
|
89
|
+
cur_col: 0,
|
90
|
+
max_value: rows * cols,
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
impl Iterator for SquareIndexer {
|
96
|
+
type Item = usize;
|
97
|
+
fn next(&mut self) -> Option<usize> {
|
98
|
+
let value = self.cur_row + (self.cur_col * self.rows);
|
99
|
+
let output = if value < self.max_value && self.cur_row < self.rows {
|
100
|
+
Some(value)
|
101
|
+
} else {
|
102
|
+
None
|
103
|
+
};
|
104
|
+
|
105
|
+
// now increment internal state to next value
|
106
|
+
self.cur_col += 1;
|
107
|
+
if self.cur_col >= self.cols {
|
108
|
+
self.cur_col = 0;
|
109
|
+
self.cur_row += 1;
|
110
|
+
}
|
111
|
+
|
112
|
+
output
|
113
|
+
}
|
114
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
extern crate crypto_square;
|
2
|
+
use crypto_square::encrypt;
|
3
|
+
|
4
|
+
fn test(input: &str, output: &str) {
|
5
|
+
assert_eq!(&encrypt(input), output);
|
6
|
+
}
|
7
|
+
|
8
|
+
#[test]
|
9
|
+
fn test_empty_input() {
|
10
|
+
test("", "")
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
#[test]
|
15
|
+
fn test_encrypt_also_decrypts_square() {
|
16
|
+
// note that you only get the exact input back if:
|
17
|
+
// 1. no punctuation
|
18
|
+
// 2. even spacing
|
19
|
+
// 3. all lowercase
|
20
|
+
// 4. square input
|
21
|
+
let example = "lime anda coco anut";
|
22
|
+
assert_eq!(example, &encrypt(&encrypt(example)));
|
23
|
+
}
|
24
|
+
|
25
|
+
#[test]
|
26
|
+
fn test_example() {
|
27
|
+
test(
|
28
|
+
"If man was meant to stay on the ground, god would have given us roots.",
|
29
|
+
"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau",
|
30
|
+
)
|
31
|
+
}
|
32
|
+
|
33
|
+
#[test]
|
34
|
+
fn test_empty_last_line() {
|
35
|
+
test("congratulate", "crl oaa ntt gue")
|
36
|
+
}
|
37
|
+
|
38
|
+
#[test]
|
39
|
+
fn test_spaces_are_reorganized() {
|
40
|
+
test("abet", "ae bt");
|
41
|
+
test("a bet", "ae bt");
|
42
|
+
test(" a b e t ", "ae bt");
|
43
|
+
}
|
44
|
+
|
45
|
+
#[test]
|
46
|
+
fn test_everything_becomes_lowercase() {
|
47
|
+
test("caSe", "cs ae");
|
48
|
+
test("cAsE", "cs ae");
|
49
|
+
test("CASE", "cs ae");
|
50
|
+
}
|
51
|
+
|
52
|
+
#[test]
|
53
|
+
fn test_ignore_non_ascii_chars() {
|
54
|
+
test(
|
55
|
+
"She got her education, then got rich programming: 👩🎓🎓👩💻💰",
|
56
|
+
"setnhm hrigpm eeoori gdnton outrgg tchir haeca",
|
57
|
+
);
|
58
|
+
}
|
59
|
+
|
60
|
+
#[test]
|
61
|
+
fn test_long() {
|
62
|
+
test(
|
63
|
+
r#"
|
64
|
+
We choose to go to the moon.
|
65
|
+
|
66
|
+
We choose to go to the moon in this decade and do the other things,
|
67
|
+
not because they are easy, but because they are hard, because that
|
68
|
+
goal will serve to organize and measure the best of our energies and
|
69
|
+
skills, because that challenge is one that we are willing to accept,
|
70
|
+
one we are unwilling to postpone, and one which we intend to win,
|
71
|
+
and the others, too.
|
72
|
+
|
73
|
+
-- John F. Kennedy, 12 September 1962
|
74
|
+
"#,
|
75
|
+
&(String::from("wohaseagabnttenwan eoennaronedcwpghnf cnmdoseaisshettidk ") +
|
76
|
+
"hwodtyhlztkaaoocte oeoobbaweoilrnphhn ocnteuriaflleeowen shihctdlnolewwseoe " +
|
77
|
+
"eoneabbldusnietitd totoueesmrbglapnhy oshtscceeeeelrotes geiheaaranciienere " +
|
78
|
+
"otsetuuvseasnuensp todrhsseuruognadtt ogeteeetrgsntwntoe tochyttoeieeoidoom " +
|
79
|
+
"htaiahhotettalowjb eodnrearhshhclnioe mtegeytgeaaacienhr"),
|
80
|
+
)
|
81
|
+
}
|
data/tracks/sml/Makefile
CHANGED
@@ -34,8 +34,8 @@ travis:
|
|
34
34
|
|
35
35
|
test-%:
|
36
36
|
$(eval exercise := $(patsubst test-%, %, $@))
|
37
|
-
@echo "# $(exercise)"
|
38
37
|
@echo
|
38
|
+
@ls ./exercises/$(exercise)/README.md > /dev/null
|
39
39
|
@cd ./exercises/$(exercise) && cat test.sml | sed 's/$(exercise).sml/example.sml/' | poly -q
|
40
40
|
@echo
|
41
41
|
|
data/tracks/sml/config.json
CHANGED
@@ -104,6 +104,36 @@
|
|
104
104
|
|
105
105
|
]
|
106
106
|
},
|
107
|
+
{
|
108
|
+
"uuid": "2bfc685e-0d13-0280-de5e-53bc093e3a8c5ac7c73",
|
109
|
+
"slug": "atbash-cipher",
|
110
|
+
"core": false,
|
111
|
+
"unlocked_by": null,
|
112
|
+
"difficulty": 1,
|
113
|
+
"topics": [
|
114
|
+
|
115
|
+
]
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"uuid": "b83ce171-06e6-dd80-080e-9dd189bf6df83833e92",
|
119
|
+
"slug": "perfect-numbers",
|
120
|
+
"core": false,
|
121
|
+
"unlocked_by": null,
|
122
|
+
"difficulty": 1,
|
123
|
+
"topics": [
|
124
|
+
|
125
|
+
]
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"uuid": "42adb6ed-09f0-6980-2d4f-75ac90cc2bf1f59fb3a",
|
129
|
+
"slug": "pangram",
|
130
|
+
"core": false,
|
131
|
+
"unlocked_by": null,
|
132
|
+
"difficulty": 1,
|
133
|
+
"topics": [
|
134
|
+
|
135
|
+
]
|
136
|
+
},
|
107
137
|
{
|
108
138
|
"uuid": "225cfd7d-81a3-4a58-b1aa-1de2e40e7a93",
|
109
139
|
"slug": "binary",
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Atbash Cipher
|
2
|
+
|
3
|
+
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
|
4
|
+
|
5
|
+
The Atbash cipher is a simple substitution cipher that relies on
|
6
|
+
transposing all the letters in the alphabet such that the resulting
|
7
|
+
alphabet is backwards. The first letter is replaced with the last
|
8
|
+
letter, the second with the second-last, and so on.
|
9
|
+
|
10
|
+
An Atbash cipher for the Latin alphabet would be as follows:
|
11
|
+
|
12
|
+
```plain
|
13
|
+
Plain: abcdefghijklmnopqrstuvwxyz
|
14
|
+
Cipher: zyxwvutsrqponmlkjihgfedcba
|
15
|
+
```
|
16
|
+
|
17
|
+
It is a very weak cipher because it only has one possible key, and it is
|
18
|
+
a simple monoalphabetic substitution cipher. However, this may not have
|
19
|
+
been an issue in the cipher's time.
|
20
|
+
|
21
|
+
Ciphertext is written out in groups of fixed length, the traditional group size
|
22
|
+
being 5 letters, and punctuation is excluded. This is to make it harder to guess
|
23
|
+
things based on word boundaries.
|
24
|
+
|
25
|
+
## Examples
|
26
|
+
- Encoding `test` gives `gvhg`
|
27
|
+
- Decoding `gvhg` gives `test`
|
28
|
+
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
|
29
|
+
|
30
|
+
## Loading your exercise implementation in PolyML
|
31
|
+
|
32
|
+
```
|
33
|
+
$ poly --use {exercise}.sml
|
34
|
+
```
|
35
|
+
|
36
|
+
Or:
|
37
|
+
|
38
|
+
```
|
39
|
+
$ poly
|
40
|
+
> use "{exercise}.sml";
|
41
|
+
```
|
42
|
+
|
43
|
+
**Note:** You have to replace {exercise}.
|
44
|
+
|
45
|
+
## Running the tests
|
46
|
+
|
47
|
+
```
|
48
|
+
$ poly -q --use test.sml
|
49
|
+
```
|
50
|
+
|
51
|
+
## Feedback, Issues, Pull Requests
|
52
|
+
|
53
|
+
The [exercism/sml](https://github.com/exercism/sml) repository on
|
54
|
+
GitHub is the home for all of the Standard ML exercises.
|
55
|
+
|
56
|
+
If you have feedback about an exercise, or want to help implementing a new
|
57
|
+
one, head over there and create an issue. We'll do our best to help you!
|
58
|
+
|
59
|
+
## Source
|
60
|
+
|
61
|
+
Wikipedia [http://en.wikipedia.org/wiki/Atbash](http://en.wikipedia.org/wiki/Atbash)
|
62
|
+
|
63
|
+
## Submitting Incomplete Solutions
|
64
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|