Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It doesn't matter, I was able to exploit random tests.
Random tests make ZERO sense. A load is given, even before any save was called.
what the hack
Integer
constructor deprecation warning in Java's full tests:The preferred method nowadays is
Integer.valueOf(j)
.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
or0
would have made the API clearer. The defaultUP
direction does not make much sense either.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.
Wonderful ! Thanks
Gives a value of: -2
From the description:
From the description:
What about [-1, -2, -3, -4, -5, -7, -8] array?
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.
.
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) sinceIntEnum
instances are treated as integers.Fork
is not clear code !
Loading more items...