Repository navigation
Planning
- difficulty modes
- what does difficulty set
- size of board
- number of bombs
- visibility of counters
- possible options:
- easy
- dimensions: 10x10
- bombs: 10
- medium
- dimensions: 15x15
- bombs: 40
- hard
- dimensions: 20x30
- bombs: 100
- extras!
- do not show bomb counter
- easy
- what does difficulty set
- User selects mode to play (at any time)
- Create game board based on options
- Start timer and show counters
- Game has begun, run loop!
- User clicks on a cell
- Run game logic to check what happens
- Show current board state to the user
- if win/lose, do whatever and exit loop
- timer stops
- Present options, go back to step 1
class Cell
- properties:
- isBomb: bomb or not (boolean)
- hasFlag: (boolean)
- hasQuestionMark: (boolean)
- adjacentBombs: (0-8)
- isVisible (boolean)
class GameBoard
-
properties:
- board (2D array of cell objects)
- bombNum
- flagsPlanted
- complete (boolean)
- numOfOpenCells
-
methods:
-
constructor(rowNum, colNum, bombNum)
-
generateBoard()
- create the array with right row/col count
- place bombs in
- placeBomb() method
- calculate for each cell how many bombs are around them
-
clearing()
- when you click on a cell w/ a value of 0, it will open up all 8 adjacent cells. Additionally, any cells that are opened w/ a value of 0 will also call on clearing().
-
checkCell()
-
if isVisible is true or hasFlag is true, do nothing
-
call checkWinGame() and checkLoseGame()
- act accordingly with the related displays if true
-
check for number (call clearing() if value is 0)
-
make cell visible
-
-
markCell()
-
if isVisible is true, do nothing
-
check property of cell being clicked, based on that:
- place flag or question mark
-
-
checkWinGame()
- when all non-bomb cells are open to win
-
checkLoseGame()
- when a bomb in clicked (lose)
-
winDisplay()
- stop and display "win"
- play again
-
loseDisplay()
- Unsmile
- show all bombs locations
- "go back to menu" button
-
-
draw the playing board
- have some icon/whatever for a unidentified cell
- have an icon/whatever for the flag
- have an icon/whatever for the question marks
- have an icon/whatever for a number (adjecent bombs)
- have an icon/whatever for a blank square
- have an icon/whatever for a bomb
-
show number of bombs
-
counters, what to show:
- number of bombs remaining (based on flags marked)
- timer since first click
- (extra if time) number of moves
- (extra if time) number of cells visible/not visible
-
put smiley face
-
add event listener for when cell is left clicked
- call checkCell()
-
add event listener for when cell is right clicked
- call markCell()
-
add event listener for dropdown for new game based on difficulty of (easy, medium, hard)
-
add event listener for pause button (maybe, if we include pause button?)
-
possible convenience thing: right click on open cell to auto open adjacent ones (if bombs around have been found)