1 of 2

What surrounds my Minesweeper tile?

Minesweeper is a puzzle game where mines are hidden around a board of nondescript tiles with the goal of identifying the location of all mines. Clicking on a mine loses the game, but clicking on any other tile will reveal a number from 0-8 which signifies how many mines directly surround it.

Given a number, you must display a random* possible combination of empty tiles and mines surrounding it. This should be in the form of a 3x3 array. The center tile should be the number of mines taken as input.

*Must have a non-zero chance for all combinations to occur.


Examples

_ = blank square
X = mine

0

___
_0_
___

1

_X_
_1_
___

1

___
_1_
X__

___
_1_
__X

4

_X_
X4X
_X_

4

X_X
_4_
X_X

4

___
X4X
X_X

8

XXX
X8X
XXX

Input

  • The number of mines surrounding the center tile (0-8)

Output

  • Any reasonable form of output that displays the 3x3 array of tiles

Other rules

  • Each combination does not have to have an equal chance of happening. There just must be a non-zero chance of each combination to occur when executing your program.
  • Any 2 characters can be chosen for the mine and empty tile.
  • This is code golf, the program with fewest bytes wins.