');
$devbox = $('#devbox');
}
// Start Minesweeper
$board = $('#board');
$grid = $('#grid');
var $timer = $('#timer');
var $mineCounter = $('#minecounter');
var $levelSelect = $('#level');
var levels = {
'beginner': '9x9x10',
'intermediate': '16x16x44',
'expert': '16x30x99'
};
var level = $levelSelect.val();
var levelParams,
rows,
$rows,
columns,
cellCount,
mines,
freeCells,
mineTally,
beginnerHighScore = 999,
intermediateHighScore = 999,
expertHighScore = 999;
var countColors = {0: '', 1: 'blue', 2: 'green', 3: 'red', 4: 'blue-dark', 5: 'maroon', 6: 'turquoise', 7: 'purple', 8: 'gray-dark'};
time = 0;
timer = false;
unstarted = true;
var statusIndicator = '
';
// Check for existing high score
if (localStorage.getItem('beginner')) {
beginnerHighScore = localStorage.getItem('beginner');
populateHighScore('beginner', localStorage.getItem('beginner'));
}
if (localStorage.getItem('intermediate')) {
intermediateHighScore = localStorage.getItem('intermediate');
populateHighScore('intermediate', localStorage.getItem('intermediate'));
}
if (localStorage.getItem('expert')) {
expertHighScore = localStorage.getItem('expert');
populateHighScore('expert', localStorage.getItem('expert'));
}
function setLevel(level) {
levelParams = levels[level];
rows = parseInt(levelParams.split('x')[0]);
columns = parseInt(levelParams.split('x')[1]);
cellCount = rows*columns;
mines = levelParams.split('x')[2];
freeCells = cellCount - mines;
}
function setBoard(level) {
// Clear Grid
$grid.html(statusIndicator).removeClass('disabled lose win').addClass('unstarted');
// Set Up Grid
setLevel(level);
// Set unstarted
unstarted = true;
// Build Rows
for (r=0;r
';
}
$grid.append('