Ad
  • Default User Avatar

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

  • Custom User Avatar

    You're saying this is a just the warm-up kata? o_O

  • Custom User Avatar

    Link to part 2 added :)

  • Default User Avatar

    Thank you for the feedback and for trying out this kata!

    Yes, I have a couple of ideas in these directions - I thought I would be able to come up with a general theory on optimal solution but I found a mistake in my first attempt so I will have to return to it when I have some new ideas.

    In the meantime I did a bunch of random simulations of movesets and found experimentally that the 500 moves limit held for all of them, hence the current upper bound (insert joke about differences between mathematicians, physicists, and engineers).

    I'll tag you if I have a nice idea for a draft/improved version in the future!

  • Default User Avatar

    Aha, thank you for attempting this little kata - as you can see it hasn't been very popular since 2-3 months!

    In fact as you can see below, it was my 2nd (I think) ever attempt at writing a kata and I had lots of challenges trying to understand the various comments and designing the tests; I've returned to it a few times since then, every time I find a better way of doing things. Feel free to copy-paste anything if you find it useful.

    In effect you are right about the "information leaking" issue; I forget how I originally tried to implement this but with @Voile and @hobovsky and @Madjosz comments + some digging myself through the Python test suite, I learnt about the preloaded code and the various ways to fail tests early.

    I really like your suggestion though so I implemented it also - thanks! The preloaded functions now all have such assert messages, while the "grown up" versions in the full test cases work for any value of n.

    By the way - since you seem to have a promising kata-author future ahead of you - I will share my general lesson learnt from this specific kata: it's really difficult to design ones based on "sequences/patterns" because you either have to hide too much (so people complain about not having feedback to debug) or when you give away expected results then people just Google/OEIS the small dataset and find the answer immediately. So that's why I have since tried to avoid doing them.

    Anyways, glad you enjoyed this - I wrote it after discovering this problem and felt really proud of solving it myself; people who Google/OEIS these kind of puzzles miss out on the enjoyment of figuring things out just to get +2/3 meaningless Internet Points - I don't understand them!