Minesweeper in JS & Optimal Move Calculation