Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:09:12+00:00 2026-06-11T02:09:12+00:00

I have spent 4 days with this one issue and have search countless of

  • 0

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) {
                                continue;
                            }
                            else 
                                if(inBounds(rows + i, cols + j))
                                board[i][j]=(char)(48+adjacentMines(i,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 |

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:09:14+00:00Added an answer on June 11, 2026 at 2:09 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have spent the last 2 days trying to sort this one out.
I have spent days trying to figure this out to no avail. I have
I have spent days on this trying out all the JSON libraries including the
I've spent two days on this and have gotten nowhere. I'm trying to use
I spent days trying to solve this one: I'm trying to create a chart
I have spent several days now researching Hibernate and have several small questions about
Have spent an hour trying to solve this - but to no avail. I'm
I have spent hours in this problem and my fellows couldn't help me out.
I have spent all Friday and Saturday on this and I am running out
This is a follow up to this question . Have spent days on this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.