Skip to content

Add crypto-square.json #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 16, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions crypto-square.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"normalized_plaintext": {
"description": "the spaces and punctuation are removed from the English text and the message is downcased",
"cases" : [
{
"description": "Lowercase",
"plaintext": "Hello",
"expected": "hello"
},
{
"description": "Remove spaces",
"plaintext": "Hi there",
"expected": "hithere"
},
{
"description": "Remove punctuation",
"plaintext": "@1, 2%, 3 Go!",
"expected": "123go"
}
]
},
"plaintext_segments": {
"description": "The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, such that `c >= r` and `c - r <= 1`, where `c` is the number of columns and `r` is the number of rows.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation, I think (or my viewer is being weird)

"cases" : [
{
"description": "empty plaintext results in an empty rectangle",
"plaintext": "",
"expected": "[]"
},
{
"description": "4 character plaintext results in an 2x2 rectangle",
"plaintext": "Ab Cd",
"expected": "[ab, cd]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is a single string representing the list. I am wondering whether it would be easier for languages to handle it if it were a list of strings: ["ab", "cd"]

},
{
"description": "9 character plaintext results in an 3x3 rectangle",
"plaintext": "This is fun!",
"expected": "[thi, sis, fun]"
},
{
"description": "54 character plaintext results in an 8x7 rectangle",
"plaintext": "If man was meant to stay on the ground, god would have given us roots.",
"expected": "[ifmanwas, meanttos, tayonthe, groundgo, dwouldha, vegivenu, sroots]"
}
]
},
"encoded": {
"description": "The coded message is obtained by reading down the columns going left to right.",
"cases" : [
{
"description": "empty plaintext results in an empty encode",
"plaintext": "",
"expected": ""
},
{
"description": "Non-empty plaintext results in the combined plaintext_segments",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does there need to be an underscore in the plaintext_segments here?

"plaintext": "If man was meant to stay on the ground, god would have given us roots.",
"expected": "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau"
}
]
},
"ciphertext": {
"description": "Output the encoded text in chunks. Phrases that fill perfect squares `(r X r)` should be output in `r`-length chunks separated by spaces. Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a thought about whether this should be a string versus a list of strings, but current languages are using just strings, so I lean toward that (no change).

"cases" : [
{
"description": "empty plaintext results in an empty ciphertext",
"plaintext": "",
"expected": ""
},
{
"description": "9 character plaintext results in 3 chunks of 3 characters",
"plaintext": "This is fun!",
"expected": "tsf hiu isn"
},
{
"description": "54 character plaintext results in 7 chunks, the last two padded with spaces",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be confusing, as they are not in fact padded with spaces in the text given below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be padded correctly now.

"plaintext": "If man was meant to stay on the ground, god would have given us roots.",
"expected": "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau"
}
]
}
}