Ad
  • Custom User Avatar

    I rarely say bad things about a kata, but this one was confusing in Java.

    My main problem was that my direction always should be something of 2/4/6/8, it is constantly tested, just as my initial direction as 8. But at the same time if the player presses 8, I cannot start moving into that direction, even though basically I was facing that direction already. I let that go, because initial state and stuff.

    But then random tests started failing, because apparently if every key is released, I should "lose" my direction (well, obviously not actually lose it, because the tests will still test it, there was a rule that I should not change direction if nothing is pressed). But then once again, I am facing a direction, and if that key is pressed, i should not start moving, but should face into that direction even more. I mean I could figure it out, but I think the rules of this game are a bit unclear.

    Even if you do not accept something like direction -1 for "rest state" (just from the top of my head), it could be clarified in the rules, that even if you technically face a direction at the beginning of the game and after all keys were relesed, you should never start moving instantly. Technically rule #2 implies something like you should never start moving before the second iteration of a key being pressed, but the first rule implies that you should not start moving because you should first change your direction.

    Still gave it a Somewhat though, the idea is really cool.

  • Custom User Avatar

    Not gonna lie, I postponed solving this one for a long time, because I always felt this is gonna be so hard and complicated, my code will time out etc. Finally started to actually code it, it was fun and it took me no more than 3 hours to pass all tests, so yeah... I was wrong.
    Do not let the description or the unusual problem discourage you, it is a really cool one! Do not be like me, give it a try!

  • Custom User Avatar

    Thank you for your hard work!

  • Custom User Avatar

    Really cool kata, it should be much more popular. The description seems scary, but the task itself is not that hard. Give it a try!

  • Custom User Avatar

    Thank you for the review!

    • Contructor got removed, solve() is now static and expecting the cave as an input
    • Logs removed from random tests
    • Tests are now grouped into 100 element groups, the overall number remains the same
    • The three issue was actually the same error, you found all pits yet remained distrustful when it came to squares near to SOUND blocks. It is now fixed, and the edge cases you found got added as sample tests. Nice catch, thank you!

    Grouping the tests into different suites, I'm not sure either if it is possible. I could probably put the 20 sample tests into the same @Test when it comes to executing all of them, so it would look a bit cleaner... ? The order of the n-pit random tests would remain messed up tho.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Hi! I updated it to save the result into a variable, and only put the variable into the assertion, hope that fixes the issue. Thank you for pointing it out!

  • Custom User Avatar

    Hi! Thank you for your insight, I tried to fix everything. Please let me know, if you think something could be done better.

  • Custom User Avatar
  • Custom User Avatar

    You are absolutely right, it was not working properly for cases where the arrow starts from the beginning of the string. My python solution contained the right version of the operator, but somehow I mistranslated it. Sadly there were no fix tests with an arrow starting at the beginning of the string, so thank you very much for your insight!

    I updated the solution, and also added a sample test with string "-->" to cover this case.

  • Custom User Avatar

    I updated the solution, it contained an error. Also added a fixed sample test to cover the issue. Please check and approve! Sorry for the inconvinience!

  • Custom User Avatar
  • Custom User Avatar

    It was satisfying to finally solve this one. I am interested, do you accept translations on this one? I would love to translate it to Java, but there is a 2-year pending translation in Coffeescript already. Thought it would be the best to ask, before I spend half a day with creating a new one that will pend forever.

  • Custom User Avatar

    Thanks for the kata! I created a simple java translation, please review and accept if it looks good to you. Thanks again!

  • Loading more items...