Ad
  • Custom User Avatar
  • 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).

  • Default 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.

  • Default 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.

  • Default 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 ?