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.
The compare in the tests is a strict one, meaning the array had to be also returned in correct order for it to pass.
Use some sort of loose compare that doesn't care about order.
It sounds a bit weird to talk about 'legal move', if I'm not mistaken this kata doesn't take in account any "chess legality", we know nothing about other 'pieces' but their coordinates on the chessboard. There are strict restrictions in king's moves according to the chess rules and, unlike other katas about chess, this one has little to do with actual chess game. It'd be better to only say we should return all non occupied squares adjacent to king's position.
this part has been handled.
Almost duplicate of this kata.
Missing the word "to" ( at ".. to where .." ).
The description as written reads as if you need to determine at which squares your king can make a legal move ( to any adjacent square ). Which is a nice idea, but it's a different kata.
Specifically: there is nothing wrong with returning
[]
. Everything's wrong about returning-1
when[]
would do just fine.No random tests.
Having multiple output types is bad design.
This comment is hidden because it contains spoiler information about the solution
awesome :D
It's kinda mine solution but in ultra short and clever code, nice!