I have a problem with minesweeper, a game that im making to learn programming basics. The problem is infinite loop. I think I got a code working if there wasn't an error for a endless loop.
So when i press the left button on the mouse it starts a function called GRTRemoveBlocks, this function checks if a value that is loaded when the game starts is 0 (have no mine near).
Code:
void GRTRemoveBlocks(int n) {
if (minenear[n] == 0) {
RemoveBlock(n);
}
if the variable is 0 the game loads the function RemoveBlock.
this is a small example of the code inside:
Code:
void RemoveBlock(int n) {
#region 1-3
if (blockposint[n] == 1) {
IsBlockVisible[n + 1] = false;
IsBlockVisible[n + (int)blockamountxy.Y] = false;
IsBlockVisible[n + (int)blockamountxy.Y + 1] = false;
//this opens the GRTRemoveBlock with different n value
GRTRemoveBlocks(n + 1);
GRTRemoveBlocks(n + (int)blockamountxy.Y);
GRTRemoveBlocks(n + (int)blockamountxy.Y + 1);
}
blockposint is the position of the block
Image to show position:

Here is everything I've coded in a rar file:
http://www.mediafire.com/download.php?77ajnc93hj33g34