Not sure if it's the best use for this case. I implemented the timer essentially through combining this and this Stack Overflow questions.Because of my lack of JS expertise, there might be a better way using them (and scoping in general). The general use of scopes - Sometimes I found the need to use global variables although I'm used to them being considered a bad habit.I am pretty happy with the current state and I am posting here after a few iterations and changes, but since this is basically my first big JS/HTML/CSS project I wanted to get it reviewed especially on: A mine counter showing the current amount of unflagged mines (this relies on flags so it might not be correct at a given moment).The use of flags with a right-click (or long press on mobile).Auto-reveal when clicking an empty cell.A timer of the game which stops when the game is over (win or lose), and resets when it starts. Selection of size and difficulty (number of mines).The number in the cell tells us how many mines exist in the immediate vicinity of this cell (an empty cell is equivalent to a cell with a 0 in it). Mines are randomly placed on the board and the goal is to reveal the whole board, except for the mines! Each revealed cell will either have a mine, a number or be empty. Just to make the question self-contained: Mine Sweeper is a game with a rectangular board consisting of hidden cells. $('#difficulty li').I decided to write my own version of a Mine Sweeper game as an excuse for a Javascript/HTML/CSS project. It would be great if I can receive some critical comments about the code in general, code structure (mainly JavaScript) and best practices I should have followed.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |