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.
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).
Description cannot be approved, recent changes from related record must be merged first.
If the issues are resolved this can be an intereting kata. Nice to see the images in the description.
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.
I updated the description of the kata, trying to clarify the process of coloring the canvas. I also added some examples with the solution implemented in ruby or python.
No!
You can only use the colours in the board: purple (p), yellow (y) and blue (b). Each tile needs to be cross by two strands and it is coloured with the colour of the "upper" strand. This means that "last" strand, the second strand that cover a tile, gives the colour to the tile.
The solution you propose:
Is not correct because it draws the following canvas:
Remember that order matters, so is the last strand that give the colour to the tile. You need to think on the order of the rows and the columns to give the correct colour to each tile.
For example, this solution:
Generates the following board:
Do you see how we painted with different colours the first column?
Do you mean
col 1
should be "g" ? (green = blue x yellow ) ? ? ?('cause if
col 1
was "b" then how0x1
would be correct ? )take a look on your order:
so this solution is incorrect
2d test (canvas =
[["p","y"],["","b"]]
), this solution doesn't pass :.. what is expected ?
Ok. May be the kata is not right explained. Let me try another shot:
Each cell neds to be filled with two strands. But it is colored with the color of the last strand. So, while the last item of the list is
{:type=>"c", :index=>"1", :color=>"b"}
the element{:type=>"r", :index=>1, :color=>"b"}
can has any color.I thought 2d row
{:type=>"r", :index=>1, :color=>"b"}
should also be of color "p"No it is not a valid one. I changed it with a valid one.
Your example . . .
. . . gives "b" (blue) color for each tiles.
Is really this example a valid one ?
anything in mind?
Loading more items...