Ad
  • Custom User Avatar

    I stranded at 49 :)
    edit: 47 \o/

  • Default User Avatar

    I'm stuck at 52 :( Feeling ready to give us and not find the solution... I'm not sure if it's a trick with regex or something in the counting that I could be doing different!...

  • Custom User Avatar

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

  • Default User Avatar

    Now I understand why you were "so insistant" to have all the "0" uncovered in the initial grid... ;)

    With "real game approach", it would look like this:

    • we know: a,b has 1 mine, g,j has 1 mine, b,g has 1 mine and a,b,d,f,g has 2 mines
    • knowing there are 3 mines remaining (known from the full grid), you try different combinations that fulfill these conditions
    • you'll see that some squares never contain a mine so you can open them (this way, you will find that you can open c and f)
  • Custom User Avatar

    @pianowow, @Balkoth
    Perhaps this one should use a special logic, I named it "corner logic": If corner is ?, then this corner has at least 1 mine.(It can not using in the real game)

    0 0 0 0 0 0 0 
    1 1 1 1 1 0 0 
    x 2 3 x 2 0 0 
    2 a b x 2 0 0 
    c d 3 3 2 1 0 
    e f g 2 x 1 0 
    h i j 2 1 1 0
    
    We know: a,b has 1 mine, g,j has 1 mine, e,f,h,i has 1 mine.
    So: c,d are the safe place. open them! game can be continue..
    
  • Default User Avatar

    Well, let's say that sometimes you have to search where the mines could be... And sometimes you should search where they could not be too...

    I hope it helps. ;)

  • Default User Avatar

    Hi, can you elaborate on that test 17 ?

    It is the only test I fail, and I don't understand how you would solve it using logic.

  • Default User Avatar

    You should improve the way you check the different possible combinations and what you could do considering the whole bunch of them ;)

  • Default User Avatar

    Ok, glad you find it (and that my code isn't wrong! :) )

    Be strong! ;)

    (I hope you didn't try with the erroneous codes I posted in the message before? Sorry if that is the case :-/ )

  • Default User Avatar

    Hi,

    Interesting one...

    Seems to me it shouldn't be solvable. Could you explain the steps you used to get there?

    To avoid any troubles, please do the following:

    1. past that in the sample tests and execute it:

      gamemap = """
      0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
      0 0 0 0 0 0 0 1 1 1 0 0 0 1 ? 2
      0 0 0 0 0 0 0 1 ? 1 0 0 0 1 2 ?
      0 0 0 0 0 0 0 1 1 1 0 0 1 1 2 1
      0 0 0 1 2 2 1 0 0 0 0 0 1 ? 1 0
      1 1 1 2 ? ? 2 2 1 2 1 1 1 1 1 0
      ? ? 2 ? ? 4 ? 2 ? 2 ? 1 0 0 0 0
      1 1 2 ? 3 ? 2 2 1 2 1 1 0 0 1 1
      0 0 1 1 2 ? 1 0 0 0 0 0 0 0 1 ?
      """.strip()
      result = """
      0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
      0 0 0 0 0 0 0 1 1 1 0 0 0 1 x 2
      0 0 0 0 0 0 0 1 x 1 0 0 0 1 2 x
      0 0 0 0 0 0 0 1 1 1 0 0 1 1 2 1
      0 0 0 1 2 2 1 0 0 0 0 0 1 x 1 0
      1 1 1 2 x x 2 2 1 2 1 1 1 1 1 0
      1 x 2 3 x 4 x 2 x 2 x 1 0 0 0 0
      1 1 2 x 3 3 2 2 1 2 1 1 0 0 1 1
      0 0 1 1 2 x 1 0 0 0 0 0 0 0 1 x
      """.strip()
      game.read(gamemap, result)
      makeAssertion(solve_mine(gamemap, game.count), "")

    It will display a fail, but what interest me is what your code will return.

    1. if you find a way to solve the one above, could you explain how you do it? (Remainder, just in case: you should open a square only if you are 100% it's safe)

    2. your code should be able to get from the original grid to the one below. Make sure that it is the case, please (if it's not, then the problem lays on your side and you made a "wrong but successful" guess somewhere in your execution, I think. Unless you can explain the thing. ;) ):

      0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
      0 0 0 0 0 0 0 1 1 1 0 0 0 1 x 2
      0 0 0 0 0 0 0 1 x 1 0 0 0 1 2 x
      0 0 0 0 0 0 0 1 1 1 0 0 1 1 2 1
      0 0 0 1 2 2 1 0 0 0 0 0 1 x 1 0
      1 1 1 2 x x 2 2 1 2 1 1 1 1 1 0
      ? ? 2 ? ? 4 x 2 x 2 x 1 0 0 0 0
      1 1 2 x 3 ? 2 2 1 2 1 1 0 0 1 1
      0 0 1 1 2 ? 1 0 0 0 0 0 0 0 1 x

    Waiting for news!

  • Custom User Avatar

    OK. disabled ;-)

  • Custom User Avatar

    Thanks, I'll disable that ;-)

  • Custom User Avatar

    Thanks. It's not really fast code but it looks nice :) Wonder how noone else solved your kata yet. One tip: would be nice to add random tests...

  • Custom User Avatar

    Well, yes, golfing is an entirely different kind of challenges :P, but IMO so far the One Line Task katas have been pretty self-contained to not require too many tricks per kata.