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.
If I understand your question correctly. It has already been discussed here.
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.
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'):
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.
The quote from the description you provided literally says that:
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..
Yes, you will also take damage in this situation.
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.
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!
Yeah, it works. Thank you, you are my hero:)
Thank you.
This comment is hidden because it contains spoiler information about the solution
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.
Yes. Ok, that's exactly what I wanted to avoid :). Okay, well, life is pain. Thank you.
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.
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.
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.
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...