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.
The test cases are missing the required imports for java.util.Arrays as well as for org.junit.Assert and org.junit.Test. I think it should really not be put on the shoulders of the solver of this kata to fix the imports to be able run the local test cases at all.
The description is especially unclear and needs to be reworked:
bullet points would help to clearly decompose the steps
you're talking about iterations but you do not tell first how is chosen this number of iteration (the info is found several lines below, after you explained the whole process)
every element in odd position is shifted forward:
you do not tell if "shifted" applies "geographically" or "lexicographically"... (meaning, to move the character in the word or to change it by another char)
you don't tell if you count the position as the nth char or as indexes (== "0 indexed"). As a matter of fact, most could expect the latter, but that's not what you use.
the § explaining the ""even"" positions should be separated from its end, showing the example.
Your task would be to decrypt a given list of strings based on two inputs
That's incorrect: you're passing strings, not a list.
EDIT:
you give complete explainations for evident steps, but nothing before the final examples for the part that is the most unclear...! that looks a bit unbalanced.
Extending Array.prototype should be done with a modicum of care. for ( let i in a ) should not enumerate the prototype method after flatMap has been defined, or interesting bugs might ensue. This has happened in practice: I have defined Array.prototype.flatMap ( I called it concatMap ) in kata, and the tests would break.
Enumerability of the new prototype method should be tested. Alternatively, plain flatMap(fn,arr) could be requested instead of a prototype method.
I think this is an important point to teach people.
RISC-V Translation
We need to solve a retired kata as prerequisite to complete this kata :/
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.
Sample tests are not using
it
blocks in Python.In Swift translation a tests pass in green but the solution returns an error:
main.swift:19:13: warning: variable 'asciiValues' was never mutated; consider changing to 'let' constant
var asciiValues = text.asciiArray
~~~ ^
let
Rust translation
Duplicate of many other, better quality caesar cypher katas
A little typo in the description:
we are doing *spe[C]ial XOR*
The test cases are missing the required imports for
java.util.Arrays
as well as fororg.junit.Assert
andorg.junit.Test
. I think it should really not be put on the shoulders of the solver of this kata to fix the imports to be able run the local test cases at all.The description is especially unclear and needs to be reworked:
every element in odd position is shifted forward
:the nth char
or as indexes (== "0 indexed"). As a matter of fact, most could expect the latter, but that's not what you use.That's incorrect: you're passing strings, not a list.
EDIT:
Extending
Array.prototype
should be done with a modicum of care.for ( let i in a )
should not enumerate the prototype method afterflatMap
has been defined, or interesting bugs might ensue. This has happened in practice: I have definedArray.prototype.flatMap
( I called itconcatMap
) in kata, and the tests would break.Enumerability of the new prototype method should be tested. Alternatively, plain
flatMap(fn,arr)
could be requested instead of a prototype method.I think this is an important point to teach people.