A MineSweeper game with a 10x10 grid of cells. It has all features you would expect from a minesweeper: Random bomb generation, flagging, 0-spreading, win-lose detection etc. Each cell has a volume of 5x5x26 (=650 blocks).
The screen uses signal strength to turn on one pixel for each signal strength, the signal strength counter from bomb count goes into here, and if it is a mine a signal strength higher than 9 gets inputted to fill the entire screen. When the signal strength is 0 the middle line gets powered, and a flag turns on the top and bottom line of lamps.
For bomb generation, there is a random signal strength generator that powers one of the 10 other signal strength randomisers, one on each level, to pick one specific spot. Those 10 randomisers do not output the same value twice, to prevent two bombs being placed in the exact same spot.
Bomb counting is a simple signal strength counter that gets pulsed every time a bomb gets placed in a neighbour cell.
Win and lose detection are done using logic gates checking if the cell is on and then whether a bomb is there or not.
The buttons on the left side of the main grid can be used to generate mines and reset the game. The mine generation button generates 15 mines. To play, press the green button on a cell to open that cell, or the red one to flag the cell. When you open a tile with a bomb you lose, and when you open all tiles that are not bombs you win.
Comments
Fixes and bomb generation explanation
I Fixed the bomb generation where it sometimes wouldnt generate enough bombs.
As requested, here is an explanation of how the bomb circuit works:
First, a random number (1-10) is generated with a signal strengh (shulker box) randomiser. The 10 outputs of these each go to one of the rows. On each row there is another 1-10 randomiser, which doesn't repeat any numbers, so each number in a row will only be generated once. Then it puts a mine on that position in the selected row, and pulse the counters on all 8 cells around it so they count 1 extra mine. If a row is already fully filled it will generate a new random number for the selected row and rerun. This is not a big issue with optimisation, as there is only a very small chance that happens (10 out of 15 bombs need to generate on 1 out of 10 rows) so the extra delay for when this does happen is neglible (even more so since it also only takes about 2 extra seconds).
The reset button resets the no-repeat counters so all numbers can be generated on the new generation again.