How to check Boundaries in 2d Arrays??

So, I am making a minesweeper game and I want it to display how many mines are around the players choice like this
1
2
3
[]  []  []
[]choice[]
[]  []  []

where choice equals the number of mines in the square around it, I'm not sure how to put it into code besides
1
2
3
4
5
6
7
8
9
10
11
topLeft  = array[ x - 1 ][ y - 1 ]
top      = array[ x     ][ y - 1 ]
topRight = array[ x + 1 ][ y - 1 ]

midLeft  = array[ x - 1 ][ y     ]
midRight = array[ x + 1 ][ y     ]

botLeft  = array[ x - 1 ][ y + 1 ]
bot      = array[ x     ][ y + 1 ]
botRight = array[ x + 1 ][ y + 1 ]


ALSO, How do I check boundries in the code?

if it helps any, I am using a 5X5 array with x and @

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//Globakl Constants
const int ROWS = 5; // The board Lenght
const int COLS = 5; //The Board Width

//enum to represent every possible value in the board. //AT = bomb
enum Symbols{
STAR = 42, AT = 64, X = 88, ZERO = 0, ONE = 1, TWO = 2, THREE = 3,
FOUR = 4, FIVE = 5, SIX = 6, SEVEN = 7, EIGHT = 8, NINE = 9
};

//Structure to hold row and column coordinates
struct coordinates
{
int Rows; //an integer member that holds the row position on the board
int Cols; //an integer member that holds the column position on the board
};

int main()
{
        cout << "Please Select a Row Followed By A Space And A Column";
	cin >> coord.Rows >> coord.Cols;
	
}

....

bool checkCoord(Symbols field[ROWS][COLS], coordinates& coord)
{
//Need Help Here
}



Thanks
Last edited on
Hint: any array cell can have 3, 5 or 8 neighbors depending on it's [i, j] indices when # array rows >=3 && # array cols >= 3; so check its indices and that should give you the [i,j] locations of the neighbors
how would I go about passing my display board function into my check coord function so that I can output whatever the number of mines around the chosen number is? I am not sure how to do that.
Last edited on
Hi,

Consider the for loop:

for (int k = -1; k < 1; ++k)

Can you figure out how to extend that, and fit it into your code? Hint: if (k == 0 && m == 0) {continue;}

Edit: I am not a fan of using i, j, l for subscript variables - they look too similar or like 1. One could have names like XOffset for example, or something else that has meaning.

Last edited on
@pdgaming

Your code would look more tidy if you were to not put comments at the end of a line of code, consider putting it on the line before.

Also, if you configure your editor to indent with spaces (3 or 4 say) instead of tabs, it will display better here. This site converts tabs to 8 spaces, which results in excessive indenting.
This is what I have but i can't get it to work. What am I doing wrong??
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	for(int i = 0; i < coord.Rows; ++i)
	{
		for(int j = 0; j < coord.Cols; ++j)
		{	
			if(symbolArr[i][j] = AT)
			{
				//end game
			}
			else if(symbolArr[i][j] = STAR)
			{
				
                if( i + 1 < coord.Rows && symbolArr[i + 1][j] == STAR)
				{
					++symbolArr;
				}
                if( i + 1 < coord.Rows && j + 1 < coord.Cols && symbolArr[i + 1][j + 1] == STAR)
				{
					++symbolArr;
				}
                if( j + 1 < coord.Cols && symbolArr[i][j + 1] == STAR)
				{
					++symbolArr;
				}
                if( i - 1 >= 0 && j + 1 < coord.Cols && symbolArr[i - 1][j + 1] == STAR)
				{
					++symbolArr;
				}
                if( i - 1 >= 0 && symbolArr[i - 1][j] == STAR)
				{
					++symbolArr;
				}
                if( i - 1 >= 0 && j - 1 >= 0 && symbolArr[i - 1][j - 1] == STAR)
				{
					++symbolArr;
				}
                if( j - 1 >= 0 && symbolArr[i][j - 1] == STAR)
				{
					++symbolArr;
				}
                if( i + 1 < coord.Rows && j - 1 >= 0 && symbolArr[i + 1][j - 1] == STAR)
				{
                   ++symbolArr;					
				}
				
				symbolArr[i][j] = ZERO + ONE; 
			}
        }
    }
 
}
Last edited on
Something along these lines, perhaps:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>

constexpr int N = 5 ;
using mine_field = bool[N][N] ; // true if it is a mine
using mine_count = int[N][N] ; // count of number of mines in surrounding cells

bool valid_pos( int pos ) { return pos >= 0 && pos < N ; }
bool valid_pos( int row, int col ) { return valid_pos(row) && valid_pos(col) ; }

void reset_counts( mine_count& counts )
{ for( auto& row : counts ) for( int& c : row ) c = 0 ; }

void set_count( const mine_field& fld, mine_count& counts, int row, int col )
{
    if( fld[row][col] ) counts[row][col] = -1 ; // dummy count of -1 if it is a mine

    else // not a mine, count mines in surrounding cells
    {
        for( int delta_x : { -1, 0, +1 } )
            for( int delta_y : { -1, 0, +1 } )
            {
                const int x = row+delta_x ;
                const int y = col+delta_y ;
                if( valid_pos(x,y) ) counts[row][col] += fld[x][y] ; // += 1 if it is a mine
            }
    }
}

void set_counts( const mine_field& fld, mine_count& counts )
{
    reset_counts(counts) ;

    for( int row = 0 ; row < N ; ++row )
        for( int col = 0 ; col < N ; ++col )
            set_count( fld, counts, row, col ) ;
}

void print_fld( const mine_field& fld )
{
    for( const auto& row : fld )
    {
        for( bool v : row ) std::cout << ( v ? 'M' : '.' ) << "  " ;
        std::cout << "\n\n" ;
    }
}

void print_counts( const mine_count& counts )
{
    for( const auto& row : counts )
    {
        // print '*' if it is a mine (if count == -1)
        for( int c : row ) std::cout << ( c < 0 ? '*' : char(c+'0') ) << "  " ;
        std::cout << "\n\n" ;
    }
}

int main()
{
    const mine_field fld =
    {
        { false, true, false, true, false },
        { true, false, false, false, true },
        { false, true, false, true, false },
        { true, false, false, false, true },
        { true, false, false, false, true }
    };
    print_fld(fld) ;
    std::cout << "\n------ counts --------\n\n" ;

    mine_count counts{} ;
    set_counts( fld, counts ) ;
    print_counts(counts) ;
}

http://coliru.stacked-crooked.com/a/88fce10eb8e4cba7
You may oversize the matrix. You want 5x5, so make it 7x7 and work from 1 to 5.
That way you don't need a special case for the borders (just make sure to fill it with something that doesn't affect your computations).


> i can't get it to work
Be more specific. ¿what doesn't work?
¿is it not compilling? ¿does it crash? ¿it outputs nonsense?

1
2
if(symbolArr[i + 1][j] == STAR)
   ++symbolArr;
¿what do you think you are doing there?
++symbolArr would attempt to modify the start of your array.


To check the neighbours of (a,b) you may do
1
2
3
4
5
6
for(int K=-1; K<=1; ++K)
   for(int L=-1; L<=1; ++L){
      if( K==0 and L==0 ) continue; //center point, not a neighbour
      if( board[a+K][b+L] == STAR )
         //...
   }



@TheIdeasMan: don't sweat the small stuff
Well, I used this code to try and check the boundry and get the output but I get an error since count is a int and I am using enums.

count is what I am using to keep track of # of bombs nearby

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
int count = 0;
if (symbolArr[i][j + 1] == AT)
{
		count++;
	if (symbolArr[i + 1][j] == AT)
		count++;
	if (symbolArr[i + 1][j + 1] == AT)
		count++;
}
// index 0,9**
else if (i == 0 && j == board_Cols - 1 && symbolArr[i][j] != AT)
{
	if (symbolArr[i][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j] == AT)
		count++;
}

// index 9,0**
else if (i == board_Row - 1 && j == 0 && symbolArr[i][j] != AT)
{
	if (symbolArr[i - 1][j] == AT)
		count++;
	if (symbolArr[i][j + 1] == AT)
		count++;
	if (symbolArr[i - 1][j + 1] == AT)
		count++;
}

// index 9,9**
else if (i == board_Row - 1 && j == board_Cols - 1 && symbolArr[i][j] != AT)
{
	if (symbolArr[i - 1][j] == AT)
		count++;
	if (symbolArr[i][j - 1] == AT)
		count++;
	if (symbolArr[i - 1][j - 1] == AT)
		count++;
}

// if first row**
else if (i == 0 && (j != 0 && j != board_Cols - 1) && symbolArr[i][j] != AT)
{
	if (symbolArr[i][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j] == AT)
		count++;
	if (symbolArr[i + 1][j + 1] == AT)
		count++;
	if (symbolArr[i][j + 1] == AT)
		count++;
}

// if last row**
else if (i == board_Row - 1 && (j != 0 && j != board_Cols - 1) && symbolArr[i][j] != AT)
{
	if (symbolArr[i][j - 1] == AT)
		count++;
	if (symbolArr[i - 1][j - 1] == AT)
		count++;
	if (symbolArr[i - 1][j] == AT)
		count++;
	if (symbolArr[i - 1][j + 1] == AT)
		count++;
	if (symbolArr[i][j + 1] == AT)
		count++;
}

// if first col**
else if (j == 0 && (i != 0 && i != board_Cols - 1) && symbolArr[i][j] != AT)
{
	if (symbolArr[i - 1][j] == AT)
		count++;
	if (symbolArr[i - 1][j + 1] == AT)
		count++;
	if (symbolArr[i][j + 1] == AT)
		count++;
	if (symbolArr[i + 1][j] == AT)
		count++;
	if (symbolArr[i + 1][j + 1] == AT)
		count++;
}

// if last col**
else if (j == board_Cols - 1 && (i != 0 && i != board_Row - 1) && symbolArr[i][j] != AT)
{
	if (symbolArr[i - 1][j - 1] == AT)
		count++;
	if (symbolArr[i - 1][j] == AT)
		count++;
	if (symbolArr[i][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j] == AT)
		count++;
}

// Cells that are fully surrounded**
else if (symbolArr[i][j] != AT)
{
	if (symbolArr[i - 1][j - 1] == AT)
		count++;
	if (symbolArr[i - 1][j] == AT)
		count++;
	if (symbolArr[i - 1][j + 1] == AT)
		count++;
	if (symbolArr[i][j - 1] == AT)
		count++;
	if (symbolArr[i][j + 1] == AT)
		count++;
	if (symbolArr[i + 1][j - 1] == AT)
		count++;
	if (symbolArr[i + 1][j] == AT)
		count++;
	if (symbolArr[i + 1][j + 1] == AT)
		count++;
}
if (symbolArr[i][j] != AT)
symbolArr[i][j] = count;
count = 0;


The error I get is V... What do I need to do to keep track of the amount of bombs nearby??

1
2
3
invalid conversion from 'int' to 'Symbols' [-fpermissive] //symbols is my type enum (see above)
       field[i][j] = count;
                        ^
Last edited on
you may cast it.
field[i][j] = Symbols(count);
but I think it would be better to make int field[ROWS][COLS] instead (both in your check function and main).

> //enum to represent every possible value in the board. //AT = bomb
¿why not BOMB to represent a bomb?
¿the hell does START mean?
1
2
3
4
5
6
7
8
enum mine_state{
   BOMB = '@',
   CLEAR = '#',
   FLAG = 'X'
};

int field[ROWS][COLS];
field[4][2] = BOMB;
Edit: it is not necessary to do everything in the same board. You may have one with the bombs (true, false), another with the count (integers, compute before playing) and another with the user actions (cleared and flagged cells)


your last code looks unnecessary complicated and erroneous.
consider lines 2--9. ¿why do you check upper cell only if right cell has a bomb?
¿why are those ifs nested?
Use a loop instead (check out lines 19--25 in JLBorges' code)
Last edited on
@ne555 , unfortunately, @JLBorges, His code is in c++ 11, which unfortunately, i am not too familiar with since I just started and use c++ 98(I think?).

How would I translate his code:

Also, to asnwer your question: STAR (Not START) = * meaning when the game starts, it should be filled with stars
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void reset_counts( mine_count& counts )
{ for( auto& row : counts ) for( int& c : row ) c = 0 ; }

void set_count( const mine_field& fld, mine_count& counts, int row, int col )
{
    if( fld[row][col] ) counts[row][col] = -1 ; // dummy count of -1 if it is a mine

    else // not a mine, count mines in surrounding cells
    {
        for( int delta_x : { -1, 0, +1 } )
            for( int delta_y : { -1, 0, +1 } )
            {
                const int x = row+delta_x ;
                const int y = col+delta_y ;
                if( valid_pos(x,y) ) counts[row][col] += fld[x][y] ; // += 1 if it is a mine
            }
    }
}

=======================================================

Also, going throuhgh this site, i found another code which might be helpful to me, but again, its in c++ 11 so I don't know how to read it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
show(int jojo[DIM][DIM],int x, int y)
{
    int mines=0;
    int xoff,yoff;
 
    xoff=x-1; // Move back one
    yoff=y-1; // Move back one
    xoff = xoff < 0 ? 0 : xoff;  // make sure we're on the board
    yoff = yoff < 0 ? 0 : yoff;  // make sure we're on the board
    for(;yoff<=y && yoff < DIM;yoff++) {
         for(;xoff<=y && xoff < DIM;xoff++) {
         if(jojo[xoff][yoff])
            mines++;
         }
   }
Last edited on
what about
1
2
3
4
 for( int delta_x : { -1, 0, +1 } )
            for( int delta_y : { -1, 0, +1 } 

//on line 10-11 


and also I don't understand this piece of code
1
2
bool valid_pos( int pos ) { return pos >= 0 && pos < N ; }
bool valid_pos( int row, int col ) { return valid_pos(row) && valid_pos(col) ; }


--------------------------------------------------------------------------------------------------------------

I have completely changed my code, but I am not sure what to do here now

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
bool checkCoord(Symbols symbolArr[board_Row][board_Cols], coordinates& coord)
{
	if(symbolArr[coord.Rows][coord.Cols] = AT)
	{
		symbolArr[coord.Rows][coord.Cols] = X;
		cout << "End Game!\n";
	}
	else if(symbolArr[coord.Rows][coord.Cols] = STAR)
	{
		int count = 0;
		
		for(int xOffset = -1; xOffset < 1; xOffset++)
		{
			for(int yOffset = -1; yOffset < 1; yOffset+=)
			{
				//Here
			}
		}
	}
}
Last edited on
1
2
3
4
5
6
7
8
9
for( int delta_x : { -1, 0, +1 } ) //delta_x's value will be -1, next pass 0, next pass 1
for(int delta_x=-1; delta_x<=1; ++delta_x)

for( auto& row : counts ) for( int& c : row ) c = 0 ; //traverse the whole container, set each element to 0

	for(int i = 0; i < coord.Rows; ++i)
	{
		for(int j = 0; j < coord.Cols; ++j)
			symbolArr[i][j] = 0;



second code seems to be c++98 compatible.
If you don't understand the ternary operator
xoff = xoff < 0 ? 0 : xoff;
would be equivalent to
if( xoff<0 ) xoff = 0;

however, I think that that code is incorrect. It only checks upper left quadrant.
Last edited on
The output ALMOST works, giving me
the problem now is that the display always shows 8 (The maximum number of neighbors possible) rather than the actual number of neighbors it has. How do I fix that?

1
2
3
4
5
6
7
   0 1 2 3 4
0| * * * * @ |
1| * * * * @ |
2| @ * * * * |
3| * @ * * @ |
4| 8 * * * * |


How do I fix that.
[/code]

this is the code I have
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
bool checkCoord(Symbols symbolArr[board_Row][board_Cols], coordinates& coord)
{
	int count = 0; //keep count of how many numbers around

	if(symbolArr[coord.Rows][coord.Cols] == AT) //if user selects bomb, output X
	{
		symbolArr[coord.Rows][coord.Cols] = X;
		cout << "You hit a mine, you lose!\n";
		return true;
	}
	else if(symbolArr[coord.Rows][coord.Cols] == STAR)
	{
		for(int i = 0; i < board_Row; i++)
		{
			for(int j = 0; j < board_Cols; j++)
			{
				if (i == 0 && j == 0 && symbolArr[i][j] != AT)
				{
					if (symbolArr[i][j + 1] == AT)
						count++;
					if (symbolArr[i + 1][j] == AT)
						count++;
					if (symbolArr[i + 1][j + 1] == AT)
						count++;
				}
				// index 0,9**
				else if (i == 0 && j == board_Cols - 1 && symbolArr[i][j] != AT)
				{
					if (symbolArr[i][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j] == AT)
						count++;
				}

				// index 9,0**
				else if (i == board_Row - 1 && j == 0 && symbolArr[i][j] != AT)
				{
					if (symbolArr[i - 1][j] == AT)
						count++;
					if (symbolArr[i][j + 1] == AT)
						count++;
					if (symbolArr[i - 1][j + 1] == AT)
						count++;
				}

				// index 9,9**
				else if (i == board_Row - 1 && j == board_Cols - 1 && symbolArr[i][j] != AT)
				{
					if (symbolArr[i - 1][j] == AT)
						count++;
					if (symbolArr[i][j - 1] == AT)
						count++;
					if (symbolArr[i - 1][j - 1] == AT)
						count++;
				}

				// if first row**
				else if (i == 0 && (j != 0 && j != board_Cols - 1) && symbolArr[i][j] != AT)
				{
					if (symbolArr[i][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j] == AT)
						count++;
					if (symbolArr[i + 1][j + 1] == AT)
						count++;
					if (symbolArr[i][j + 1] == AT)
						count++;
				}

				// if last row**
				else if (i == board_Row - 1 && (j != 0 && j != board_Cols - 1) && symbolArr[i][j] != AT)
				{
					if (symbolArr[i][j - 1] == AT)
						count++;
					if (symbolArr[i - 1][j - 1] == AT)
						count++;
					if (symbolArr[i - 1][j] == AT)
						count++;
					if (symbolArr[i - 1][j + 1] == AT)
						count++;
					if (symbolArr[i][j + 1] == AT)
						count++;
				}

				// if first col**
				else if (j == 0 && (i != 0 && i != board_Cols - 1) && symbolArr[i][j] != AT)
				{
					if (symbolArr[i - 1][j] == AT)
						count++;
					if (symbolArr[i - 1][j + 1] == AT)
						count++;
					if (symbolArr[i][j + 1] == AT)
						count++;
					if (symbolArr[i + 1][j] == AT)
						count++;
					if (symbolArr[i + 1][j + 1] == AT)
						count++;
				}

				// if last col**
				else if (j == board_Cols - 1 && (i != 0 && i != board_Row - 1) && symbolArr[i][j] != AT)
				{
					if (symbolArr[i - 1][j - 1] == AT)
						count++;
					if (symbolArr[i - 1][j] == AT)
						count++;
					if (symbolArr[i][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j] == AT)
						count++;
				}

				// Cells that are fully surrounded**
				else if (symbolArr[i][j] != AT)
				{
					if (symbolArr[i - 1][j - 1] == AT)
						count++;
					if (symbolArr[i - 1][j] == AT)
						count++;
					if (symbolArr[i - 1][j + 1] == AT)
						count++;
					if (symbolArr[i][j - 1] == AT)
						count++;
					if (symbolArr[i][j + 1] == AT)
						count++;
					if (symbolArr[i + 1][j - 1] == AT)
						count++;
					if (symbolArr[i + 1][j] == AT)
						count++;
					if (symbolArr[i + 1][j + 1] == AT)
						count++;
				}	
			}
		}
		if(count == 0)
		{
			symbolArr[coord.Rows][coord.Cols] = ZERO;
		}
		if(count == 1)
		{
			symbolArr[coord.Rows][coord.Cols] = ONE;
		}
		if(count == 2)
		{
			symbolArr[coord.Rows][coord.Cols] = TWO;
		}
		if(count == 3)
		{
			symbolArr[coord.Rows][coord.Cols] = THREE;
		}
		if(count == 4)
		{
			symbolArr[coord.Rows][coord.Cols] = FOUR;
		}
		if(count == 5)
		{
			symbolArr[coord.Rows][coord.Cols] = FIVE;
		}
		if(count == 6)
		{
			symbolArr[coord.Rows][coord.Cols] = SIX;
		}
		if(count == 7)
		{
			symbolArr[coord.Rows][coord.Cols] = SEVEN;
		}
		if(count == 8)
		{
			symbolArr[coord.Rows][coord.Cols] = EIGHT;
		}
		
	}
}

----------------------------------------------------------------------------------

This is due tomorrow midnight and I have been working on this for weeks and I still can't figure it out.
Last edited on
stop, take a walk, eat something, sleep.
you are trying to do too many things at once. As a result, your code is quite messy


I had missed this edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
bool checkCoord(Symbols symbolArr[board_Row][board_Cols], coordinates& coord)
{
	if(symbolArr[coord.Rows][coord.Cols] == AT) //note: you had `=' (assignment) here
	{
		symbolArr[coord.Rows][coord.Cols] = X;
		cout << "End Game!\n";
	}
	else if(symbolArr[coord.Rows][coord.Cols] == STAR) //note: you had `=' (assignment) here
	{
		int count = 0;
		
		for(int xOffset = -1; xOffset < 1; xOffset++) //traverse the neighbours
		{
			for(int yOffset = -1; yOffset < 1; yOffset+=)
			{
				if(valid_pos(coord.Rows+xOffset, coord.Cols+yOffset) //bounds checking
				   and symbolArr[coord.Rows+xOffset][coord.Cols+yOffset] == AT)
					++count;
			}
		}
		symbolArr[coord.Rows][coord.Cols] = Symbol(count);
	}

	return true; //¿why did you say that you'll return a bool?
}



> the problem now is that the display always shows 8 (The maximum number of
> neighbors possible) rather than the actual number of neighbors it has
provide enough code to reproduce your issue. Don't post function snips, give us something compilable and runable without making us filling blanks.
Topic archived. No new replies allowed.