A complete minesweeper game using p5 js
You can place the flag on an element by clicking on element while pressing the metakey ( command on mac,ctrl on windows )
You can play it here
If the no.of un-revealed spaces around an element is equal to the number on the element,
then set all surroundings to flags
if the no.of neigbouring flags of an element is equal to the number on the element,
then reveal all other spaces
solving the constrained links for bombs using combinations of bombs that satisify the constraint,
then getting the intersection of the possibilities
Rule 4 is used in the final stages of the game when we have constraints but also limited unrevealed elements,
It follows as arranging the falgs around these spaces while satisfying the constranits,
We then make deductions from these arrangements if possible or we go by guessing using the probablities
It's basically when you have no enough information to work with,
It basically reveals random elements wishing there's no bomb there