Month: November 2014
JavaScript Mine Sweeper
While trying to get a good grasp of JavaScript/CSS, I decided to implement Mine Sweeper.
I tried to use the standard colors for the numbering and standard icons for mines/flag/unknown.
I’ve identified the 5 states that any particular cell could be and designed a finite state machine for one cell
- S is for initial state
- B is for bomb
- F is for flag
- ? is for unknown
- C is for clear

This is what the final product looks like

You may try it out at the link below
http://code.fairmutex.com/projects/web/minesweeper/
What I learned?
Discovered classList
Try to avoid recursion unless the recurring depth is shallow and the worst case scenario is known.
Good explanation about performance (may contain outdated information).
https://www.youtube.com/watch?v=mHtdZgou0qU