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.
This is realy confusing formulation.
If UDLR is just head rotation, without movements, than snake can rotate head to his neck and collide himself on next movement.
It's a first impression. ;-)
I find the 'find your way in a 2D-array' challenges usually quite tedious to code.
Not really difficult, per se, but prone to bugs. At least for me.
Are you referring to the requirements to solve it? Then I disagree. It can be done in 20-30 LoC. In fact I got smacked over the head because I rated it a 6kyu kata :D
This was my bad for reading the description poorly. I thought that U U U was identical to U 3 - not the case.
Thanks guys! appreciate it!
I was struggling with this too and then I figured out that when there's no number with the direction is considered as a head turn without movement, so you don't have to count the step.
Snake doesn't move when changing its direction. It seems this information was removed from the description during the rewrite.
Directions certainly changed but the snake didn't move...
(U doesn't mean the snake moves Up one step)
Description asks for head position and N: Number of steps leading up to and including the collision
There is a test case with these moves given: U R L D U R L D
The first move leads to a collision against the top border of the board. However the test expects [[0, 2], 0] rather than [[0, 2], 1]
Am I missing something or is this wrong?
This looks like an awful lot of work for a 5kyu.
A test that looked something like this should do it:
While I'm fine changing the description myself, I'm not going anywhere near tests. Someone with more experience can implement this.
I mentioned this below. There are no tests to see whether food is eaten twice. Logically, food should vanish off the field when consumed. My solution doesn't do this, but it currently doesn't matter. One would have to add a test where a solution that doesn't clear the food after consuming it causes the head to collide with the tail (because it grew when it shouldn't), making it fail.
Description doesn't say if food can be used multiple times or only once.
Both versions pass the tests (at least in python).
Loading more items...