public int minesNeeded(int i, int j) {
		int flags = 0;
		
		for (int x = i - 1; x <= i + 1; x++) {
			for (int y = j - 1; y <= j + 1; y++) {
				if (positionExists(x, y) || (x == i && y == j)) continue;

				if (board[x][y].isFlagged()) flags++;
			}
		}
		
		return board[i][j].numMines() - flags;
	}