Could someone explain what I am doing wrong with this 2d array game

I have spent 4 days with this one issue and have search countless of possible solutions and now I am pulling out my hair. I am trying to get a minesweeper 2d character array game to first count the mines surrounding(basically the 8 blocks surrounding the mine) a mine then convert the characters surrounding the mines to integers. I would greatly appreciate if anyone could help. This is homework that is due tomorrow. I feel like such a dummy, but I have literally spent sleepless nights working on this one issue. :'( Someone please help example m is mine here is part of a void method that is suppose to check the areas around a mine and convert them to numbers calling the adjacentMines method

    for(this.rows = 0; rows < board.length; rows++) {
           for(this.cols = 0; cols < board[rows].length; cols++) {  

            for(int i = -1; i <= 1; i++) {
                        for(int j = -1; j <= 1; j++) {
                            if(i == 0 && j == 0) {
                                if(inBounds(rows + i, cols + j))



When I want something like this I want it to look like this when I select a cordinate, where x is the selected coordinate and not a mine, so I want to the output like this. The array above is just the current state, I want numbers to replace the e in the output | 0 | 1 | 0 | | 0 | x | 1 | | 0 | 0 | 0 |


There's an empty statement:

if(inBounds(row + i, col + j)&&mineBoard[row][col]==true);

Notice the semi-colon at the end.

Also, in the latter snippet of code, the loops for i and j are redundant. You should get rid of them, and you shouldn't be counting mines for occupied cells.

Need Your Help

Matching interests(Nearest neighbour) search in SQL

php mysql sql nearest-neighbor

I'm trying to find users with similar set of interests, with the following schema..

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.