Ad
  • Default User Avatar

    Vectors did not come my mind, propapbly it would have been easier with vectors

  • Default User Avatar

    Wonderfull kata, i enjoyed a lot while i was solving. I think the level is underrated, this kata should be kyu 1.

  • Default User Avatar

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

  • Custom User Avatar

    The recursive backtracking structure is clear, what did you to reach sub 3s performance?

  • Default User Avatar

    this is the list with mines and the remaining numbers which count of not seen mines in the area. not a normal list for example
    "X"
    "X" "4" "X"
    "X"
    "4" = becomes zero because mines are known in around of them

    also my solution is accepted in all submissions except if test case have this

  • Default User Avatar

    Let us just to see the right-top corner in your result:

    '0', '1', '?', '?']
    '0', '1', '?', '?'] 
    '0', 'A', 'x', '?'] <----- The position A absolutely should not be 1 
    '0', 'x', '?', '?']        Because there are two(or more) mines around it.
    '0', 'x', 'B', '1'] <----- The position B absolutely should not be 1 
    '0', '0', 'x', '0']  (actually here is 4, if you use `open` method to open it correctly)
    
  • Default User Avatar

    Are you sure that you get the number by using method open(row,column)?
    Why the number in front of "?" in the second row is 1, instead of 2?
    Why your result contains a lot of 0s?

  • Default User Avatar

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

  • Default User Avatar

    Actually it is very fast. It can complete tests in 3 second. there can be done some optimizations such as in every recursive call "points" variable is recreated maybe it can be done outside of the function

  • Default User Avatar

    Actually your idea and my idea is the same but I think my solution is more efficient and practical then you and it also has no risk about unbalanced tree. Check out my solution

  • Default User Avatar

    Nice kata. I am very satisfied with mine solution.

  • Default User Avatar

    Hi, in the python version

    game_map = ? ? ? ? ? 0 0 0 0 0 0 0 ? ? ? 0 0 0 ? ? ?\n
    ? ? ? ? ? 0 0 0 0 0 0 0 ? ? ? 0 0 0 ? ? ?\n
    0 0 ? ? ? 0 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ?\n
    0 0 ? ? ? 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ?\n
    0 ? ? ? 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ?\n
    0 ? ? ? ? ? ? 0 0 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 0 0 0 0 1 1 1 0 0 1 2 x 1
    0 1 2 3 x x 2 1 0 1 1 1 0 0 0 0 0 0 1 1 1
    0 0 1 x 3 3 x 1 0 1 x 1 0 0 0 1 1 1 0 0 0
    0 1 2 2 1 1 1 1 0 1 1 1 0 0 0 1 x 1 0 0 0
    1 2 x 1 0 0 0 0 1 1 1 0 0 1 1 2 1 1 0 0 0
    1 x 3 2 0 0 0 0 1 x 1 0 0 1 x 1 0 0 0 1 1
    1 2 x 2 1 1 0 0 1 1 1 1 1 2 1 1 0 0 1 2 x
    0 1 1 2 x 1 0 0 0 0 0 1 x 1 1 1 1 0 1 x 2
    0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 x 2 1 2 1 1
    0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 2 x 1 1 1
    0 1 2 x 1 0 0 0 0 0 1 2 x 1 1 2 3 2 1 1 x
    0 1 x 2 1 0 0 0 0 0 1 x 2 1 1 x x 1 0 1 1
    0 1 1 1 0 0 0 0 0 0 1 1 1 0 1 2 2 1 0 0 0
    1 1 0 0 0 0 0 0 0 0 1 2 2 1 0 0 0 0 0 0 0
    x 2 1 1 1 1 1 0 1 1 2 x x 1 0 1 1 1 0 0 0
    1 2 x 1 1 x 2 1 3 x 3 2 2 1 0 1 x 1 0 0 0
    0 1 1 1 1 1 2 x 3 x 2 0 0 0 0 1 1 1 0 0 0

    but this is not solvable
    ['x', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '1', '?', '?']
    ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '?', '?']
    ['0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'x', '?']
    ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', 'x', '?', '?']
    ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', 'x', '1', '1']
    ['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0']
    ['0', '0', '0', '0', 'x', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
    ['0', '0', '0', 'x', '0', '0', 'x', '0', '0', '0', 'x', '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', 'x', '0', '0', '0', '0']
    ['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
    ['0', 'x', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0']
    ['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x']
    ['0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', 'x', '0']
    ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0']
    ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0']
    ['0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', 'x']
    ['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', 'x', 'x', '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']
    ['x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', 'x', '0', '0', '0', '0', '0', '0', '0', '0']
    ['0', '0', 'x', '0', '0', 'x', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0']
    ['0', '0', '0', '0', '0', '0', '0', 'x', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
    this is the list with mines and the remaining numbers which count of not seen mines in the area
    ther are 2 possibility mines can have
    {(0, 19), (3, 19)}
    {(3, 20), (1, 19)}
    so this map can not be solved

  • Custom User Avatar
  • Default User Avatar

    Finally I did it, medium test were killing me. :D

  • Default User Avatar

    I had a lot of fun solving it, it was a very nice kata

  • Loading more items...