MinesweeperThe classic game

A project in Vanilla Javascript

Javascript

CSS3

HTML5

This is a fully functional recreation of the classic game from Microsoft Windows with different styling.

This project is built using vanilla javascript entirely. It makes use of basic javascript functionalities. The board itself is created within javascript, using createElement('div') for an array containing the squares of the board. The bombs are assigned randomly to squares in the array using Array.sort() and Math.random(). It makes heavy use of for loops, which are cleverly used to implement a function recurrently in order to check surrounding squares for bombs.

It defines conditions for winning a game, losing a game and creating a new game.