• There's supposed to be a device.encode defined (you cannot see the definition--it is a black box and it is your task to figure out how it works). It works for me as of today, at least; not sure why it'd be undefined for you. It might've gotten fixed since you tried the kata.

  • If you are going to enforce that, then you should update the description telling about this strictness.

    I don't see the example strings written by @paulgator as partially correct, but as correct description strings inside some garbage characters which can be ignored or not, depending on the kata description.

  • There's no device.encode() defined so I cannot make sense from this. Also there's no "plain string" vs. "encoded string". I don't get how the console.log() statements, which call an undefined device.encode() function, can give any help/hint to the solution of the problem.

    Could you add some clarification to the kata? How should be interpreted those console.log() statements?

  • Thanks for your clarification, now I understand your reasons.

  • It was partially intended to be a humorous solution, but it was also intended to 1) shine a light on the lack of enforcement of the kata's stated task and 2) reflect my general dislike for being forced to accomplish a task a specific way.

    Personally, I prefer when a kata doesn't set specific limitations on how a task should be solved, allowing the solver more creative freedom in their solution. That said, there is also a lot of value in a kata which trains in the practice of a particular mechanism or technique!

    However in this case, the kata says it wants the solver to validate a password using a regex, but it only enforces the "validate a password" part. I posted this solution very early in the kata's beta period to highlight an area where this kata could have been improved, and I would have been pleased if the kata had been amended to enforce the regex requirement. The issue was also raised by another user on the kata discussion page during the beta.

    Also, my intention is not to single out or demean this kata's author (or any kata's author), but I write abusive solutions like this whenever I can, for a variety of reasons that I like to think are not particularly malicious.

    The bottom line is that I believe all kata should be held to a high standard, and if a kata stipulates a problem requirement, it should also be able to validate that the solver fulfilled that requirement.

  • WTF! Why, oh why has been this solution upvoted? I believe laoris intended to post a funny solution, but still I think this should show up. I demand down votes get implemented.

  • This comment is hidden because it contains spoiler information about the solution

  • yeah I agree. It took me so much time to solve the problem and optimize the solution until 'WTF' when I saw the top voted solution hahaha.. Anyway worth it coz I learn so much and I feel I'm still okay with my solution as it really functions so well even the rules change to what it really meant.

  • This comment is hidden because it contains spoiler information about the solution