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.
Dude out here, writing a fully documented and performance tested code snippet for one kata.
I have no idea what's happening here, beside you creating a bit field and check if all necessary bits are set.
That's pretty convoluted, but as long as it works, I guess.
I combined the most clever rated answer, after I solved it overly complicated with some conversion methods and math.
Originally I converted the directions to opposing numbers (1, -1) and (2, -2) to mathematically cancel them out more easily.
The stack approach of the best rated answer however, was so nice and short, that I took it, and some other ideas from its comment section, and shortened it as much as I could.