7 kyu
Cipher
438 of 588bubmet
Loading description...
Algorithms
Ciphers
Cryptography
Strings
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Python Translation Please review ꒰˶> ༝ <˶꒱
Preloaded
should not have declarations or definitions ofencode
anddecode
. It prevents solutions of the formconst encode = "something";
( which happens to be my favourite ).That's not what
Preloaded
is for, and it's not necessary either.Preloaded
should probably simply be empty.Republished. Massive oversight on my end, apologies.
I'm passing the example tests and then failing all the random tests with an expected value that's one longer than the input and has the last character doubled.
What's going on there?
Rectification: The decode tests have the last character doubled, the encode tests have different characters appended. Being illegible scribbles, I unfortunately cannot tell you which ones.
I can't seem to replace this. What code and node version are you using?
This comment has been hidden.
Resolved after fixing the above issue.
I do not see any difference. The other issue seems resolved, so it shouldn't be my refreshing everything.
Bit premature on the resolve?
Ugh, I swear it worked the first time I tested - I'll try to figure out the cause of the problem.
You're using
for .. in
without checking if the index is not inherited. I'm defining an enumerableString.prototype
method. They combine to create a most fun, most subtle bug. :DYou should be using
for .. of
( orfor .. in
withObject.hasOwnProperty
, orfor .. of Object.keys
); I should not be defining an enumerable method.I see; modified it to use
for .. of Object.keys
and tested your solution, which works now. :)rEncode
hasfor .. in Object.keys
. I doubt that's gonna work.rDecode
correctly hasfor .. of Object.keys
.The decode tests do too much work BTW. You only need a reference encoder, not a decoder: store the generated solution, encode it, pass it to the user solution, compare its output with the stored solution.
Either
in
orof
would work because the keys and values are both the same as each other, but fixed that too.It works until I define an enumerable
Array.prototype
method. :yum:Other than that, you're correct of course. :]