Ad
  • Custom User Avatar

    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).

  • Custom User Avatar

    Description cannot be approved, recent changes from related record must be merged first.

  • Custom User Avatar

    If the issues are resolved this can be an intereting kata. Nice to see the images in the description.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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 calling solution_to_canvas(solution) again, comparing its result with the already mutated canvas, and of course there is a match.

    I tried it that way, and passed all the tests.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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:

    {:type=>"r", :index=>0, :color=>"p"}
    {:type=>"r", :index=>1, :color=>"b"}
    {:type=>"c", :index=>0, :color=>"p"}
    {:type=>"c", :index=>1, :color=>"y"}
    

    Is not correct because it draws the following canvas:

    [["p", "y"],
     ["p", "y"]]
    

    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:

    {:type=>"r", :index=>0, :color=>"p"}
    {:type=>"c", :index=>0, :color=>"b"}
    {:type=>"r", :index=>1, :color=>"p"}
    {:type=>"c", :index=>1, :color=>"y"}
    

    Generates the following board:

    [["b", "y"],
     ["p", "y"]]
    

    Do you see how we painted with different colours the first column?

  • Custom User Avatar

    Do you mean col 1 should be "g" ? (green = blue x yellow ) ? ? ?
    ('cause if col 1 was "b" then how 0x1 would be correct ? )

  • Custom User Avatar

    take a look on your order:

     1. row 0 to purple
     2. row 1 to blue
     3. col 0 to purple --> so (0,0) is colored to purple (correct)
     4. col 1 to yellow --> so (0,1) is colored to yellow (correct) & so (1,1) is colored to yellow and must be blue (wrong)
    

    so this solution is incorrect

  • Custom User Avatar

    2d test (canvas = [["p","y"],["","b"]]), this solution doesn't pass :

    {:type=>"r", :index=>0, :color=>"p"}
    {:type=>"r", :index=>1, :color=>"b"}
    {:type=>"c", :index=>0, :color=>"p"}
    {:type=>"c", :index=>1, :color=>"y"}
    

    .. what is expected ?

  • Custom User Avatar

    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.

  • Custom User Avatar

    I thought 2d row {:type=>"r", :index=>1, :color=>"b"} should also be of color "p"

  • Custom User Avatar

    No it is not a valid one. I changed it with a valid one.

  • Custom User Avatar

    Your example . . .

    [{:type=>"r", :index=>0, :color=>"b"}, {:type=>"r", :index=>1, :color=>"b"}, {:type=>"c", :index=>"0", :color=>"b"}, {:type=>"c", :index=>"1", :color=>"b"}]
    

    . . . gives "b" (blue) color for each tiles.
    Is really this example a valid one ?

  • Custom User Avatar

    anything in mind?

  • Loading more items...