Ad
  • Custom User Avatar

    If I understand your question correctly. It has already been discussed here.

  • Custom User Avatar

    Also the condition "If you move away from them" is disturbing because this condition should never be true since the moment you move away from the enemy, you are not on an adjacent cell anymore.
    Let me give you an example:

       E
       >
    actions: F
    

    In this example, you are on an adjacent square to an enemy. Your action is to take a step forward. The moment you attempt to move, you take damage, after which (if you are alive) you move one square forward. That is, you need to assess the situation around you before making a move, first registering the damage you take, then making a move. I hope this is useful and helps someone in the future.

  • Custom User Avatar

    Yes, I agree that the description could have been better. But regarding attacking and taking damage afterwards, it's in the description (block 'Attack mechanics and enemies'):

    Just remember that you attack and use objects before the enemies besides you attack. Here is an example where two enemies would attack you

    EEE                      EEE
     >E        =>             >
    EEE        action: A     EEE
    hp: 3                    hp: 1
    

    It's quite another matter of tests. For example, I just checked that this behavior is not implemented in my solution and it still passes all tests. I don't remember the reasons why I didn't implement it, as I solved this problem quite a long time ago. I only register the damage from "Demon Lord". Accordingly, there is no test for the case given in the description, or there are tests, but in moments when the defense of my character in such moments does not allow to receive damage.

  • Custom User Avatar

    The quote from the description you provided literally says that:

    However, an enemy CAN ATTACK YOU (whatever your orientation is), as long as you are on an adjacent cell to the enemy (vertically or horizontally, not diagonally) AND if one of those conditions is fullfilled.

    Three conditions - additional options for when you can be attacked by enemies, besides the case when you are on the cell adjacent to the enemy.
    Accordingly, after you have attacked one enemy, all other enemies on neighboring squares (if the basic condition is met) attack you according to basic rule..

  • Custom User Avatar
    E     ->    E
    >            >
    

    Yes, you will also take damage in this situation.

  • Custom User Avatar

    After you have taken 5 steps forward and approached the enemy, the next step is to turn 180 degrees, this is where you get the first damage; the second damage you get on the next step when moving forward. That answers your original question.

  • Custom User Avatar

    I didn't notice any bugs, the only thing is that I didn't use the "katas" table at all, but everyone has their own approach, I think it's okay.
    p.s. @dfhwze, I am amazed at your productivity in creating kata, keep it up!

  • Custom User Avatar

    Yeah, it works. Thank you, you are my hero:)

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Hi. I have written an algorithm. Tested locally on the last fixed test, the result is the same. But when I try to test on codewars I get an error: "PG::SyntaxError: ERROR: unterminated dollar-quoted string at or near "$$". And I can't understand what the problem is, the same code works for me both in PyCharm and PGAdmin. Accordingly, I can't check the code's operability and efficiency on other tests. Can someone help me please? I can publish the code under a spoiler.

  • Custom User Avatar

    Yes. Ok, that's exactly what I wanted to avoid :). Okay, well, life is pain. Thank you.

  • Custom User Avatar

    Okay. This looks interesting. But if it is possible to get a database dump, for example, for the last fixed test to work on it locally? Debugging everything on codewars will be n times harder.
    p.s. I understand absolutely nothing about ruby.

  • Custom User Avatar

    You can start by being given a starting map. It has inputs = I; outputs = O; empty elements = E. For inputs and outputs you can unambiguously say where their boundaries are. For example, between two inputs there can be no boundary, between an input and an output there must be a boundary, etc. So it is worth starting with this logic, marking all possible initial boundaries.
    After this work is done you need to make an assumption about the empty element E, it can be either an input or an output. So, making an assumption for each E, you need to find the maximum number of elements that can be outputs when the line around all inputs will be closed.
    Regarding the question about Kruskal's algorithm. I haven't used it. However, you will need to do checks in the process that you can get from an arbitrary entry point to any other entry point. Perhaps you can come up with an implementation using the algorithm you mentioned).
    I hope this helps you get your act together and solve the problem.

  • Custom User Avatar

    First of all I would like to thank you for this kata. It was a very interesting and good challenge. First of all, I am sorry that after 4 years it is still in beta, that few people are trying to solve it and only a few have solved it. I would really like to see it get some attention and get it to release.
    I would like to add that some corner cases are not tested.

    1. For example, there are only three maps in fixed tests where there is a first aid kit. Perhaps we should add such a case to the random tests?
    2. Also not tested are maps in which enemies are near the player's starting position on the map. That is, cases when the player in any case initially receives damage, for example, something like this. Perhaps we should take into account such cases?
    field = [
      'SHM   |EX',
      '###   ###',
      'CCK     C',
      ' E      E',
      'DEE    E<',
    ]
    
    1. All the cards except the one you gave as an example in the description are 5x9. I think we should do some tests with larger maps?

    These are just thoughts after solving the problem, perhaps you have a different opinion on this? Anyway, thank you very much, the evening was well spent:D

  • Loading more items...