Skip to content

tmchuynh/JS-Minesweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JS-Minesweeper

The code starts by defining a function called setLevel. This function takes in a level number as input and sets the number of rows, columns, mines, and free cells based on the level. The next line is an assignment statement that assigns the value of parseInt to rows. The parseInt function takes in two arguments: string and integer. It splits up the string into individual characters (in this case x) and then returns each character's numeric value (in this case 0). Then it multiplies those values together to get the total number of rows for that level (in this case 10). Next is another assignment statement that assigns column values to columns using parseInt again with one argument: string and integer. In this example, it would split up "x" into individual characters (in this case 1) and return their numeric values (1 multiplied by 2 equals 2). Then it multiplies those numbers together to get the total number of columns for that level (10).

The code starts by clearing the grid, setting the level, and setting the game to unstarted. Then it sets up a new row and column with an empty cell in each of them. Next, it builds rows and columns for all four possible outcomes: win, lose, mine-counter reset (mine counter is set to 0), and timer reset. Finally, it resets the timer so that there will be no time limit on this turn. The code starts by clearing the grid because when you start a new game or change levels of difficulty you want to clear out any previous games from memory so that they don't interfere with your current one. The next line sets up a new row and column with an empty cell in each of them; these are used as placeholders for future cells which will be filled later on during gameplay. The next line builds rows and columns for all four possible outcomes: win, lose, mine-counter reset (mine counter is set to 0), and timer reset; these are used as placeholders for future cells which will be filled later on during gameplay too!

The code starts by setting the initial board to level 0. Then, when the user clicks on the reset button, it changes its text to "😮". When they release their mouse from over the button, it changes back to "🙂". The code starts by setting a timer that will stop after 10 seconds. The next line sets a variable called levelSelect with whatever is in $levelSelect at that moment. The next line sets the board based on what was set in levelSelect and then stops the timer.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published