3
$\begingroup$

Can you place thirteen mines on a Minesweeper grid such that they create seven 5s? The size of the grid can be arbitrary. The mines may create numbers other than 5s, but those are irrelevant.

A similar question about 4s is here:

Twelve Minesweeper mines that make twelve 4s

Good luck!

$\endgroup$

3 Answers 3

3
$\begingroup$

How about (another horrible ascii depiction):

.**.**.
.55555.
*******
..55...
..**...

$\endgroup$
2
  • $\begingroup$ Correct and great work! Different from my solution, but it works. You are very good at these puzzles. $\endgroup$ Sep 18, 2019 at 2:30
  • 1
    $\begingroup$ @DmitryKamenetsky I spent a while on the last one. For this one, I just took the solution to 4 and tweaked it a little. $\endgroup$
    – JS1
    Sep 18, 2019 at 2:31
3
$\begingroup$

I brute forced an answer using my minesweeper library at https://github.com/bradmarder/MSEngine

I apologize if this is considered cheating. Here is the snippet of code I used to calculate the answer.

private static void Test()
{
    var watch = System.Diagnostics.Stopwatch.StartNew();
    var iteration = 0;

    while (true)
    {
        var board = Engine.Instance.GenerateBoard(5, 8, 13);
        var count = board.Tiles.Count(x => !x.HasMine && x.AdjacentMineCount == 5);

        if (count == 7)
        {
            var failBoard = BoardStateMachine.GetFailedBoard(board);
            Console.WriteLine(GetBoardAsciiArt(failBoard));
            break;
        }

        Interlocked.Increment(ref iteration);
        Console.SetCursorPosition(0, Console.CursorTop);
        Console.Write($"Iteration = {iteration}, and ellapsed MS = {watch.ElapsedMilliseconds}");
    }
}

012x2
02x5x
14x5x
x5x52
x5x5x
14x5x
02x31
01110

This code took 2,031,528 iterations to find a board that satisfied the criteria. On a side note, I played around with this code to find answers to some of your other Minesweeper questions, but the solutions are exceptionally rare. I stopped running the code after 100+ million failed iterations.

$\endgroup$
0
$\begingroup$

The solution to this problem and its generalizations (more mines on larger grids) can be found in my integer sequence:

https://oeis.org/A302929/

The actual solutions are here:

https://oeis.org/A302929/a302929.txt

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.