Ad
  • Default User Avatar

    You can solve it by the applying the following logic. Consider the places A and B:

      ?  ?  ?  C  A  B
      2  2  2  1  2  2
      2  X  2  ·  1  X
      2  X  2  1  2  2
      1  1  1  1  X  1
      ·  ·  ·  1  1  1
    

    The number 2 below B forces a mine to be either in A or B. That means, that the 2 blow A is aloready satisfied (it already touches one mine, and now another one from either A or B).
    Thus, C can be safely opened:

      ?  ?  ?  1  ?  ?
      2  2  2  1  2  2
      2  X  2  ·  1  X
      2  X  2  1  2  2
      1  1  1  1  X  1
      ·  ·  ·  1  1  1
    

    Now we can apply the same logic to the left side:

      A  B  C  1  ?  ?
      2  2  2  1  2  2
      2  X  2  ·  1  X
      2  X  2  1  2  2
      1  1  1  1  X  1
      ·  ·  ·  1  1  1
    

    By the same logic, C can be opened (because either A or B contains one mine):

      ?  ?  1  1  ?  ?
      2  2  2  1  2  2
      2  X  2  ·  1  X
      2  X  2  1  2  2
      1  1  1  1  X  1
      ·  ·  ·  1  1  1
    

    Now from this state, the board can be solved easily again.

  • Default User Avatar

    You should write a function with which you can print the board at any moment with all the information that you need. And don't try to solve this kata in the browser, I think the complexity demands an IDE / Editor with debugging capabilities

  • Default User Avatar

    I cannot relate to the downvotes, that is a totally valid comment.