# Thirteen Minesweeper mines that make seven 5s

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!

How about (another horrible ascii depiction):

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

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

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.

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