Ad
  • Custom User Avatar

    It doesn't matter, I was able to exploit random tests.

  • Custom User Avatar

    Random tests make ZERO sense. A load is given, even before any save was called.

  • Custom User Avatar
  • Custom User Avatar

    Integer constructor deprecation warning in Java's full tests:

    warning: [removal] Integer(int) in Integer has been deprecated and marked for removal:
    
    src/test/java/SolutionTest.java:228:
    
    for (int j: releasedArr) stack.remove(new Integer(j));
    

    The preferred method nowadays is Integer.valueOf(j).

  • Custom User Avatar

    I liked the kata but I agree, this part about always having a direction even when no keys are pressed at all and therefore there is no movement is weird. An invalid/uninitialized direction like e.g. -1 or 0 would have made the API clearer. The default UP direction does not make much sense either.

  • 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
  • Custom User Avatar
  • Custom User Avatar

    From the description:

    The numbers will also all be unique and in ascending order.

  • Custom User Avatar

    From the description:

    The numbers will also all be unique and in ascending order.

  • Custom User Avatar

    What about [-1, -2, -3, -4, -5, -7, -8] array?

  • Custom User Avatar

    for those still interested: 8, 2, 4, 6 are obviously numbers on the keypad on the keyboard. Like, literally, if you look at the right-hand-side of the full-sized keyboard, these four numbers have arrows printed on them: 8 is up, 2 is down, 4 is left and 6 is right.

  • Custom User Avatar
  • Custom User Avatar

    In Python the description mentions enum, but there is no enum to be found. You have to get direction numbers from sample test cases.

    How about actually adding IntEnum holding directions? It does not break the existing solutions (and doesn't even require changing tests) since IntEnum instances are treated as integers.

    Fork

  • Custom User Avatar

    is not clear code !

  • Loading more items...