Ad
  • Custom User Avatar

    like it! :)

  • Default User Avatar

    For those (like me) who could not understand the description, the following is used to encode the message (no spoilers, just clarification):

    1. Reverse the message.
    2. Append the password to the end of the reversed-message.
    3. Calculate n fibonacci numbers (1, 1, 2, 3, 5, 8, ...) where n is the length of the password.
    4. 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.

  • Custom User Avatar

    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.

  • Default User Avatar

    that is insane, it looks like pseudocode

  • Default User Avatar

    I'm guessing the rats that survived felt just as dead due to serious hangover

  • Custom User Avatar
  • Default User Avatar

    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...

  • Default User Avatar

    not sure what I'm doing wrong.

    1. I get the ascii value of each character
    2. I get the new value of ascii value by applying the rule.
    3. If the new value is greater than 255, then I get the value - 256 to wrap it back within the 0-255 range.

    I'm not sure what I'm missing here.

  • Custom User Avatar

    Approved!

  • Default User Avatar
  • Default User Avatar

    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

  • Custom User Avatar

    Already mentioned in description

  • Custom User Avatar

    Already mentioned in description

  • Custom User Avatar

    It's a puzzle. Explaining it defeats the purpose.

  • Custom User Avatar

    the instruction is not clear to be honest
    last part could someone explain it in another way please

  • Loading more items...