4 kyu

Top Down Movement System

83 of 206EatYourBeetS
Description
Loading description...
Games
Logic
Puzzles
View
AllIssues3Questions1Suggestions3Show Resolved
  • Please sign in or sign up to leave a comment.
  • trashy_incel 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).

  • koba1996 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.

  • avermakov 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

  • FArekkusu Avatar

    It should be stated that the key-press always resets the direction, even when the character is already facing in that same direction.

  • RealKenshiro Avatar

    Great kata but very tedious to debug!

    Overall, very instructive. Thanks!

  • user9644768 Avatar

    keys correspond to the enum Direction shown below.

    Not all language have enum construct, these part of the description should be made language specific.

  • user6793616 Avatar

    Not as difficult as what the kyu rating suggests.

  • DreamyHacker Avatar

    sampleTests(SolutionTest) Log Press Down Press Left Press Right Wrong direction after update; expected:<4> but was:<2>

    Hi, I have a question here. When I was running the sample test, it said the expected direction was 4, which was Left. However, the precedence of Down was over that of Left. Could someone explain to me why the expected direction was not Down??

  • bogdan.f Avatar

    Why Direction enum is 8, 2, 4, 6? Why not 0, 1, 2, 3?

  • thomwoz Avatar

    Nice Kata, but one thing in my opinion is not explained well.

    1. When a key is first pressed, the player has to change his direction to that of the current key, without moving

    Ok, understandable, but then you set the direction to 8 in the very beginning, thus implying that first direction is UP, and if UP is the first move, we can move straight away, and do not need to change direction to the one that is already set properly (I thought I don't need to change from 8 to 8, but I was wrong).

    Also, when you press some keys, and a direction is set, let's say, to 8, then we release all the keys (but the direction stays as 8), then we press 8 again, I thought that the player can move straight away, because his direction was already set in the proper direction. It wasn't obvious from the instructions that you need to change direction once again from 8 to 8.

    In my opinion, you should state in the instructions, that in the beginning, and whenever there's a situation that ALL the keys are released, the direction is set to NONE.

  • Blind4Basics Avatar

    Was approvable, but all solutions invalid except the one of the author and mine (due to some changes in the tests)... So I approved to 4 kyu, but might be a bit high. Let see what the others will say about that.

  • Blind4Basics Avatar

    Hi,

    Java translation here!

    • I added 2 new tests (2 edge cases) and moreover, I added random tests. I strongly recommand that you update the C# and python versions with those (the lack of random tests is generally considered as an issue). If needed, I can help for the python version.
    • I added some features too, in the way the tests are done: I display in the console what actions are done between each update. In java, this is the only way the warrior can keep track of the different tests that are done, but I think this could be a nice feature in other languages too. This part is up to you. ;)

    Cheers!

  • Blind4Basics Avatar

    Hi,

    There's something weird with the code blocks in the description: both C# and python version shouldn't be visible at the same time. I tried to update the thing in the edit panel (you used Python instead of python ; I don't know how c# is expected there... I tried c# and C# instead of csharp but I still can see both blocks in the description... :/

  • Blind4Basics Avatar

    Hi,

    It's a nice one you did there. :)

    I added the __str__ method to the Tile class in python, so that Tiles objects are easily printable for debugging stuff. I don't know C# to add it there too.

    Verifying the validations, I saw that you inverted test cases and example tests in C# and that you had all tests in the example tests of python. So I inverted them in C# and I removed the second bunch of tests in the example tests of python.

    'Hope you won't mind... ;)