Ad
  • Default User Avatar

    I've just made a translation to Java of this kata. Please take a look at it and approve it if you consider it correct:
    https://www.codewars.com/kumite/664fa3ac97f86799e35207bb?sel=664fa3ac97f86799e35207bb

  • Default User Avatar

    I've incorporated your suggestion to the kata description.

  • Default User Avatar

    Any suggestion for a less confusing single word for "same-color adjacent rectangular regions"?

  • Default User Avatar

    I marked them as containing spoilers because they contain hints (sometimes subtle ones, sometimes even quite specific) about how someone could resolve the kata. Sorry about that.
    Maybe I can try to make more concise comments in which I only answer the question without details or possible hints.

    Answering your question without spoilers:

    No, the shape of the found regions does not alter how many you should find, so it doesn't matter. The count is the same.

    With respect to overlapping regions, you should think how would you decompose that into rectangular regions, even if they are adjacent and of the same color. So, answering your question, that would be decomposed into 3 regions.

    Maybe "overlapping" is not the best name. I wanted to convey a single word for same-color adjacent regions.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Sample tests are checking for the requirements of the kata (empty input, simple data, etc).
    I have gone through the tests to see if they are representative and I think they are: They check for empty pictures (size 0), simple pictures (one region), pictures with overlapping regions, pictures with non-overlapping regions in different orientations, and other simple pictures.

    What comes next in the full test suite is just bigger pictures with bigger regions, but more or less the same as these simple tests.

    Is there some specific test that is troubling you? I can see if I can devise an example test for a confusing part of later tests if it helps.
    Anyway, thanks for the feedback!

  • Default User Avatar

    I've corrected the ordering both for the sample tests and for the full test suite, including not only the order of individual tests but also the order of groups of tests. I hope that reduces confusion.

  • Default User Avatar

    I've added a new random generator for this specific case. I hope this makes the test suite more robust to catch these things.

  • Default User Avatar

    I've added random tests that generate pictures with potentially many overlapping regions.

    You can try if you want.
    Thanks again for the feedback

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    First, thanks for the feedback! I've made some changes according to your comment.

    I've added tests for "overlapping" regions of the same color, and I have updated the solution to account for these cases.
    In the process I've simplified the logic to count regions. It was initially prepared for a more difficult problem, but I kept it. Anyway, just for counting regions that complexity is not really necessary, so I've removed it.

    You can try again if you want.