Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Nice!

    I thought about the same approach too but didn't persue it to the end, so brute-force for me :P

  • Custom User Avatar

    @evk You should be able to solve it now :)All Fixed!

  • Custom User Avatar

    could you please post your code? I am trying to fix the kata :)

  • Custom User Avatar

    yes, I used vector product to determine side of line.

  • Custom User Avatar

    looks same as me ;-)

  • Custom User Avatar

    one more ques. Did your code pass this test?

    Test.assertEquals(inside([[0,0],[6,0],[3,6]],[[1,0.000001],[2,0.00000001]]),true);
    
  • Custom User Avatar

    Thats weird :( could you please check my random test cases and see what's wrong?

  • Custom User Avatar

    This time, it's really fixed, isn't it? ;-)

  • Custom User Avatar

    I know your solution is clever than mine ;-), I can improve my solution to solve the case like above. But I can't guarantee that every testcase is consistent with you, because my solution is a bit stupid(Although it runs faster than your code ;-)). I don't want to lengthen my code(will do the last fix for the case above), because now the test code can not be republish with 100 testcases(50 testcase can republish, but 100 testcase always fail).
    So I will use my secret weapon to end this duel. Yes, the real ending(you will see, but later).
    I think the difference between these results is not related to the bug of the code, it is more like the difference in intelligence. I will modify the test code, at least to ensure that the user's code is more intelligent than mine, that's OK ;-)

    BTW: You changed the rank from 4kyu to 2kyu? Yes, I think it should be a proper evaluation ;-)

    BBBBTW:I can't understand the logic of this case:

    var map=
    `0 0 ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 ? ?
    0 0 ? ? ? ? ? ? ? ? ? ? 0 0 0 0 ? ? ? ? ?
    0 0 0 ? ? ? ? ? ? ? ? ? ? ? ? 0 ? ? ? ? ?
    0 0 0 0 0 ? ? ? ? ? ? ? ? ? ? 0 ? ? ? 0 0
    0 0 0 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0
    0 0 0 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0
    0 0 0 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0
    0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? 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 1 0 0
    1 1 0 0 1 2 x 1 0 0 0 1 2 x 1 0 1 2 2 1 0
    0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 x 1 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 0
    0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 x 2 1
    0 0 1 x 1 0 1 x 1 0 1 x 1 0 0 0 0 1 2 x 1
    0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0`
    
    
    game.read(result)
    Test.assertSimilar(solveMine(map,40),result)
    

    Your solution can got the all results, but my solution only can got:

    rest mines: 3
    0 0 1 x x ? ? ? ? ? 1 0 0 0 0 0 0 0 0 1 1
    0 0 1 3 x x 2 1 ? ? 2 1 0 0 0 0 1 1 1 1 x
    0 0 0 1 2 2 2 ? 2 2 x 1 1 1 1 0 1 x 1 1 1
    0 0 0 0 0 1 3 ? 3 3 2 2 1 x 1 0 1 1 1 0 0
    0 0 0 0 1 2 x x x 4 x 1 1 1 1 1 1 1 0 0 0
    0 0 0 0 1 x 3 4 x x 3 2 1 2 1 2 x 1 0 0 0
    0 0 0 0 1 1 1 1 3 x 2 2 x 4 x 3 2 2 0 0 0
    0 0 0 0 0 0 0 0 1 1 1 2 x x 2 2 x 1 0 0 0
    0 0 0 0 0 0 0 1 1 1 0 1 2 2 1 1 1 1 0 0 0
    1 1 1 0 0 0 0 1 x 1 0 0 0 1 1 1 0 0 0 0 0
    2 x 1 0 1 1 1 1 1 1 0 1 1 2 x 1 1 1 1 0 0
    x 2 1 0 1 x 2 1 0 0 0 1 x 3 2 1 1 x 1 0 0
    1 1 0 0 1 2 x 1 0 0 0 1 2 x 1 0 1 2 2 1 0
    0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 x 1 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 0
    0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 x 2 1
    0 0 1 x 1 0 1 x 1 0 1 x 1 0 0 0 0 1 2 x 1
    0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    

    I didn't figure out the logic...

  • Custom User Avatar

    my solution can get correct result too, if you test it in the old testcode? ;-)

  • Custom User Avatar

    Code more and more long...
    Fixed?

  • Custom User Avatar

    I know what's happening, but I'm a bit busy now. So, please wait the ball ;-)

  • Custom User Avatar

    using your solution:

    Testing for:
    map = 
    0 0 0 0 0 0 0 ? ? ?
    ? ? ? ? ? ? 0 ? ? ?
    ? ? ? ? ? ? 0 ? ? ?
    ? ? ? ? ? ? 0 ? ? ?
    0 0 ? ? ? ? ? ? 0 0
    0 0 ? ? ? ? ? ? ? ?
    0 0 ? ? ? ? ? ? ? ?
    0 0 0 0 ? ? ? ? ? ?
    0 0 0 0 ? ? ? ? ? ?
    0 0 0 ? ? ? ? 0 0 0
    0 0 0 ? ? ? ? 0 0 0
    0 0 0 ? ? ? ? 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    ? ? 0 ? ? ? 0 0 0 0
    ? ? 0 ? ? ? 0 0 0 0
    ? ? ? ? ? ? ? ? ? 0
    ? ? ? ? ? ? ? ? ? ?
    ? ? ? ? ? ? ? ? ? ?
    0 0 ? ? ? 0 0 ? ? ?
    0 0 ? ? ? ? ? ? ? ?
    0 0 ? ? ? ? ? ? ? ?
    0 0 0 0 0 ? ? ? ? ?
    n = 23 
    Correct answer is:
    0 0 0 0 0 0 0 1 1 1
    1 1 1 1 1 1 0 2 x 2
    1 x 2 2 x 1 0 2 x 2
    1 1 2 x 2 1 0 1 1 1
    0 0 2 2 2 1 1 1 0 0
    0 0 1 x 1 1 x 2 1 1
    0 0 1 1 2 2 2 3 x 2
    0 0 0 0 1 x 1 2 x 2
    0 0 0 0 1 1 1 1 1 1
    0 0 0 1 2 2 1 0 0 0
    0 0 0 1 x x 1 0 0 0
    0 0 0 1 2 2 1 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    1 1 0 1 1 1 0 0 0 0
    x 1 0 1 x 1 0 0 0 0
    2 3 1 3 2 2 1 1 1 0
    x 2 x 2 x 1 1 x 2 1
    1 2 1 2 1 1 1 2 x 1
    0 0 1 1 1 0 0 1 1 1
    0 0 1 x 1 1 1 2 2 2
    0 0 1 1 1 1 x 2 x x
    0 0 0 0 0 1 1 2 2 2 
    Your answer is:
    ? 
    

    I added this to the basic tests

  • Custom User Avatar

    Smart logic ;-)
    fixed? ;-)

    EDIT: fixed, and smart than your solution ;-)
    Now your solution seems is incorrect:
    In some testcases, my solution opened all blocks, but your solution can not(return "?")

  • Loading more items...