For those (like me) who could not understand the description, the following is used to encode the message (no spoilers, just clarification):
Reverse the message.
Append the password to the end of the reversed-message.
Calculate n fibonacci numbers (1, 1, 2, 3, 5, 8, ...) where n is the length of the password.
For each of the n calculated fibonacci numbers, rotate the letters of the password-appended-reversed-message by that number. Evenly indexed letters rotate forward (a -> b -> ... -> y -> z -> a), oddly indexed letters rotate backward (z -> y -> ... -> b -> a -> z).
The goal is to write a function that reverses the above process to decode the message.
As certain comments noted below, the kata premise is incorrect: there are almost infinitely many encodings that can perform this task, but the kata assumes one scheme and asks us to guess (read: read kata author's mind) the scheme and derive the result using this scheme.
A proper testing scheme would need to have us provision the scheme, then read the result using said scheme, such as this kata.
Disregard. Can't believe I didn't think of this initially haha.
For anyone looking at this, there are other ways to wrap it so values are within the 0-255 range.
Think about remainders...
looks like there is a problem with the random tests. I don't have any variable asciiValues in my solution. running the attempt lead to that: exit code 132
main.swift:19:13: warning: variable 'asciiValues' was never mutated; consider changing to 'let' constant var asciiValues = text.asciiArray ~~~ ^ let
RISC-V Translation
We need to solve a retired kata as prerequisite to complete this kata :/
"get a string as text and an int as the rule of manipulation, and should return encrypted text"
So why don't you describe the rule?
like it! :)
For those (like me) who could not understand the description, the following is used to encode the message (no spoilers, just clarification):
The goal is to write a function that reverses the above process to decode the message.
As certain comments noted below, the kata premise is incorrect: there are almost infinitely many encodings that can perform this task, but the kata assumes one scheme and asks us to guess (read: read kata author's mind) the scheme and derive the result using this scheme.
A proper testing scheme would need to have us provision the scheme, then read the result using said scheme, such as this kata.
that is insane, it looks like pseudocode
I'm guessing the rats that survived felt just as dead due to serious hangover
Nice!
Disregard. Can't believe I didn't think of this initially haha.
For anyone looking at this, there are other ways to wrap it so values are within the 0-255 range.
Think about remainders...
not sure what I'm doing wrong.
I'm not sure what I'm missing here.
Approved!
Python update (new testing framework)
looks like there is a problem with the random tests. I don't have any variable asciiValues in my solution. running the attempt lead to that: exit code 132
main.swift:19:13: warning: variable 'asciiValues' was never mutated; consider changing to 'let' constant var asciiValues = text.asciiArray ~~~ ^ let
Already mentioned in description
Loading more items...