mirror of https://github.com/01-edu/public.git
docs(cytale_cipher) correct grammar
This commit is contained in:
parent
ea708717c5
commit
ad7c443467
|
@ -2,49 +2,38 @@
|
||||||
|
|
||||||
### Instructions
|
### Instructions
|
||||||
|
|
||||||
Create a function called `scytale_cipher` that takes a `string` and an `integer` and returns a `string`.
|
Create a **function** which creates a scytale cipher (also known as spartan cipher).
|
||||||
This function should create a scytale cipher also known as spartan cipher. In practice its a cylinder with a
|
|
||||||
strip strapped around it on which is written a message, when removed the strip the message is coded.
|
|
||||||
Depending on the size of the cylinder the message would change. So the only way to decipher the coded message is
|
|
||||||
by using a cylinder of the same size.
|
|
||||||
|
|
||||||
You function should recreate the scytale cipher, the string being the message and the size being the number of
|
In practice, it is represented by a strip wrapped around a cylinder. The message is written across the loops of the strip (not along the strip). The message becomes *coded* if the radius of the cylinder changes, or the strip is removed from the cylinder.
|
||||||
straps in the cylinder.
|
|
||||||
|
Your function should recreate the scytale cipher, so that the `String` represents the message, and the `u32` represents the number of times the strip is wrapped around the cylinder.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
message : "scytale Code"
|
**size 6:** `"scytale Code"` -> `"sec yCtoadle"`
|
||||||
size : 6
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
['s', 'e']
|
--------------------------------
|
||||||
['c', ' ']
|
|s| |c| |y| |t| |a| |l|
|
||||||
['y', 'C']
|
|e| | | |C| |o| |d| |e|
|
||||||
['t', 'o']
|
--------------------------------
|
||||||
['a', 'd']
|
|
||||||
['l', 'e']
|
|
||||||
```
|
```
|
||||||
|
|
||||||
output : sec yCtoadle
|
**size 8:** `"scytale Code"` -> `"sCcoydtea l e"`
|
||||||
size : 8
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
['s', 'C']
|
------------------------------------------
|
||||||
['c', 'o']
|
|s| |c| |y| |t| |a| |l| |e| | |
|
||||||
['y', 'd']
|
|C| |o| |d| |e| | | | | | | | |
|
||||||
['t', 'e']
|
------------------------------------------
|
||||||
['a', ' ']
|
|
||||||
['l', ' ']
|
|
||||||
['e', ' ']
|
|
||||||
[' ', ' ']
|
|
||||||
```
|
```
|
||||||
|
|
||||||
output : sCcoydtea l e
|
|
||||||
|
|
||||||
### Expected Functions
|
### Expected Functions
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
fn scytale_cipher(message: String, i: u32) -> String {}
|
fn scytale_cipher(message: String, i: u32) -> String {
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
Loading…
Reference in New Issue