lesson-cover

Go Back

Front End Engineering

MineSweeper

Create a game called MineSweeper Demo

  • Acceptance Criteria

    • Generate a 10x10 board. There should be 10 bombs hidden within the board.
    • If user clicks on a bomb, they lose. If not, the box reveals a number. This number represents how many bombs there are in the 8 boxes surrounding it. (Therefore it is not possible to have a number greater than 8)
    • If the revealed number is 0, reveal all 8 boxes around the 0. If any of the revealed boxes are also 0, reveal all the unrevealed 8 boxes around them and recursively continue.
    • Users should be able to ctrl+click or right click on a box to flag it as a potential bomb, but they can still click on it
    • Game ends when all the non-bomb boxes are revealed.
    • At the end of the game, user should be able to replay the game.

  • Steps and Points

    • (15 points) Create a box class and use that to create a 2D array to display a nxn box.
    • (15 points) Write a function that randomly makes n boxes with a bomb inside, and add logic to end the game once a bomb is clicked.
    • (15 points) Write a function that returns the array of neighbors when you click on a non-bomb box, then display the number of bombs around that box.
    • (25 points) Recursively call surrounding boxes when its count is 0.
    • (15 points) Write function to check if user has won (number of revealed boxes + bombs) should equal nxn.
    • (15 points) Polish (like control-click to label).