Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm designing a minesweeper game, and I'm a bit confused as to how to calculate the score.

The objective of my game is to reveal all the non-flagged boxes. Marking the flag must not count toward the score. Just showing the number of seconds required to complete a board seems obsolete as I have a variable board size which is decided by the user. I studied the Wikipedia page on Minesweeper regarding the two scoring techniques.

But I don't understand how to calculate the 3BV. Is it just the number of left clicks done by user done during the game, or is the 3BV the minimum number of clicks required to complete the board? Also how can 3BV/s be judged: does a higher or lower score give a higher ranking?

Regarding my implementation

I used an integer array with all zeros and 9 designating a mine position. When a user click in the grid I calculate the nearby cells and then display the appropriate number and if he clicks on cell with value 9 then game is over.

share|improve this question
This is a really well-written question with an extremely well-written answer! Congratulations! – Shotgun Ninja Oct 3 '13 at 15:39
I've done some editing but there are a couple of bits I'm not sure I've edited as well as I could have. Could someone check this for me? – doppelgreener Oct 4 '13 at 9:12
up vote 5 down vote accepted

The 3BV score is essentially counting the number of clicks required to reveal all non-mine squares.

A Minesweeper board is essentially an m*n array. To calculate the 3BV, you will need to process the cells in this array in a particular order, so you will need to be able to mark each cell after you process it (so you don't process it multiple times). Then, use the following two procedures:


For each empty ("0") cell C:
  If C has already been marked, continue.
  Mark C. Add 1 to your 3BV count.
  Call FloodFillMark(C).
For each non-marked, non-mine cell:
  Add 1 to your 3BV count.


For every non-marked neighbor N of C (diagonal and orthogonal):
  Mark N.
  If N is an empty cell, call FloodFillMark(N).

(EDIT: There was a small typo above.)

As for 3BV/s, that is just the 3BV score divided by the time the player used to solve the puzzle. Since each 3BV point represents a separate action, higher scores are better (you perform more actions per second).

EDIT: As an example, I'm going to use the one from Wikipedia, which looks like this:


The algorithm works by marking cells after they have been processed. To visualize that, I will be using a * to indicate a processed cell, and a . to indicate a non-processed cell. Hence, we start with these markings:


We're going to start by processing the top-left cell. This is an empty (blank or 0) cell, so we start a flood fill marking all blank cells connected to this one, as well as all non-blank cells directly adjacent to these. We start by marking the cell we're processing:


The flood fill takes many steps, and exactly how the intermediate steps look depend on exactly how you implement the flood fill. Ultimately, however, it ends up looking like this:


That's all one big region, so that just adds 1 to our 3BV calculation.

Since there are no blank cells left, all we need to do is count the number of non-marked, non-mine cells. Those cells are placed at the locations marked #:


There are 7 such cells, so we add a total of 7 to the count, leaving a result of 8.

Now, you've mentioned that your representation only contains 0 and 9 (where 9 is a mine). That is, however, just going to change how you determine whether or not a cell is empty - the algorithm is the same. In your case, a cell is empty if the cell and all of its neighbors are all 0.

share|improve this answer
Sorry @Michael I didn't understand your approach. Why do I need to find the 3BV separately? If I keep updating the 3BV as the number of left clicks made by the user to reveal all the boxes and then divide it by seconds, that won't be fine? I think your procedure is calculating the minimum number of 3BV(or the left clicks) for a given board. Can you explain me with an example if possible. – meteors Oct 3 '13 at 11:56
3BV is an objective measure of board difficulty; the user's actual performance has no impact on the 3BV score. If you want to measure how many clicks the user actually needs, that is not 3BV, that is just the number of clicks (but you could compute e.g. a clicks/3BV score if you wanted to). – Michael Madsen Oct 3 '13 at 12:16
Thanks @Michael for the example. – meteors Oct 3 '13 at 15:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.