The player has won if
numUnopenedCells == numBombs
(where a cell is unopened if it is in its initial state, or flagged as a mine).
- If
numUnopenedCells > numBombs
then the player has unopened cells which are not bombs (i.e. some work left to do)
- If
numUnopenedCells < numBombs
then the player has necessarily "opened" a bomb cell and already lost.
I know its going to be part of the actionlistener that detects clicks, at some point the last click should detect a winner.
Yes, this snippet would be executed directly or indirectly by the action listener. I'd suggest you have a model of the game state, and in the openCell(int x, int y)
method you check the above, and take the appropriate action.