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.
what kind of sorcery is this?
Good one. Funny. I didn't actually laughed though.
Based on the tags, I'd assume the author intended a regex solution but I would always endorse built-in functions when they're more succinct and readable. :)
You are right... I guess I was temporaly blinded. Thanks Unnamed.
So even in such short a description you managed to miss a whole sentence...
This comment is hidden because it contains spoiler information about the solution
Well, the kata says it takes place in the desert, and while I guess you can have insurmountable dunes, it does not include such enitites in the description (which would be an entirely different problem). The drawing above is furthermore misleading - on the left hand side you go 2 steps east, then 1 north (even if it is drawn as 2 east, 2 north) while on the right hand side it is 3 north, 1 east (again, drawn as 3 north, 2 east). Assuming that each step of the instructions are all of unit 1 (otherwise,
SOUTH NORTH
would not necessarily end up the same place), the drawings really reprents the two pathswhich are clearly not the same thing.
The kata really only need a few words to make the task more clear, such as to say what is meant by not reasonable i.e., two consequitive steps in opposing directions.
I think the confussion comes from the fact that naturally takes the set of operations
{NORTH,SOUTH,EAST,WEST}
as commutative and associative. That is for any three operatorsa
,b
, andc
in the setbut the test breaks that intuition. What the test seems to say is that operators in the same vertical or horizontal direction are commutative
but not between horizontal and vertical directions
nor are the operations associative between vertical and horizontal
(this may seem odd, but on the left-hand side the
(NORTH SOUTH)
is the identity, but on the right hand side(SOUTH EAST)
does not reduce). Thus, the kata is really dealing with two algebraic groups{NORTH,SOUTH,id}
{EAST,WEST,id}
for which the convolution operations are commutative and associative within each group separately but not between the groups. This, I think, is not how people read the kata - they think of the single algebraic group
{NORTH,SOUTH,EAST,WEST,id}
with a single convolution operator.
Are you sure?
If you get different result, then you're reducing the array wrong somehow.
Expected: '['EAST', 'NORTH']', instead got: '['NORTH', 'EAST']'
Isn't the same? I mean, my result is correctly reducting the direction, either going North - East or East - North will end up at the same place.
This comment is hidden because it contains spoiler information about the solution
Finally got it & passed the kata. Thanks for your tips and patience Chrono! Ure the man.
Yes, it was, but you mutated it.
This comment is hidden because it contains spoiler information about the solution
Ok, thanks guys.
The error is right what the error message says: you're trying to reverse what you're expecting to be an array while, in fact, it's an
undefined
value. Also, passing the sample tests doesn't mean that you will definitely pass the main tests.Not a kata issue.
Loading more items...