Ad
  • 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
    • 24  PERFORM create_temp_tables(product_identifier);
      25  WITH
      

      24  PERFORM create_temp_tables(product_identifier); WITH
      
    • 60  cur_date = end_dates[i];
      61  SELECT
      

      60  cur_date = end_dates[i]; SELECT
      
  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Long story short, it's a problem with the ruby test library from codewars (the run_sql function incorrectly truncates the literal string in some cases).

    I can take a look at it if you post your code. :)

  • 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

    no pain, no gain

  • Custom User Avatar

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

  • Custom User Avatar

    You could use a select statement to iterate all tables and build insert statements from that using dynamic sql. I can't think of an easier way.

  • Loading more items...