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.
https://www.codewars.com/kata/reviews/558bbf9af493a7db2100017c/groups/647896650b7e7f00010c22c6
You should mention in the kata description that this kata is based on the mobile game Strata (which you've mentioned somewhere else, but not here).
There need to be more tests (7 is not enough), with larger inputs (larger than 3x3) and random tests. Right now the correct answers can easily be hard-coded in the solution code.
Also, with so few and small tests there is no insentive to look for an efficient algorithm.
You should protect the tests against a solution that mutates the canvas. Currently it is possible to create a random solution for the given canvas size and given colors, and then rewrite the canvas list with the return value of
solution_to_canvas(solution)
. Your tests then go on to compare the returned "solution" by callingsolution_to_canvas(solution)
again, comparing its result with the already mutatedcanvas
, and of course there is a match.I tried it that way, and passed all the tests.
2d test (canvas =
[["p","y"],["","b"]]
), this solution doesn't pass :.. what is expected ?