|
@ -36,7 +36,6 @@ unsigned int height = MIDDLE; |
|
|
int num_bombs = MIDDLE * MIDDLE / NORMAL; |
|
|
int num_bombs = MIDDLE * MIDDLE / NORMAL; |
|
|
#pragma endregion //Global |
|
|
#pragma endregion //Global |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void minesweeper_start(){ |
|
|
void minesweeper_start(){ |
|
|
system("clear"); |
|
|
system("clear"); |
|
|
main_menu_minesweeper(); |
|
|
main_menu_minesweeper(); |
|
@ -93,13 +92,18 @@ void game_minesweeper(){ |
|
|
x = x + y * board.width; |
|
|
x = x + y * board.width; |
|
|
if(t == 0){ |
|
|
if(t == 0){ |
|
|
int bombs = open_tile(&board, x); |
|
|
int bombs = open_tile(&board, x); |
|
|
if(bombs == -1){running = false;} |
|
|
|
|
|
|
|
|
if(bombs == -1){printf("You Lose!"); getchar(); break;} |
|
|
else if(bombs == 0){open_empty_space(&board, x, 0);} |
|
|
else if(bombs == 0){open_empty_space(&board, x, 0);} |
|
|
else{board.tiles[x] = bombs + 48;} |
|
|
else{board.tiles[x] = bombs + 48;} |
|
|
} |
|
|
} |
|
|
if(t == 1){board.tiles[x] = board.tiles[x] == FLAG ? BLOCK : board.tiles[x] == BLOCK ? FLAG : board.tiles[x];} |
|
|
if(t == 1){board.tiles[x] = board.tiles[x] == FLAG ? BLOCK : board.tiles[x] == BLOCK ? FLAG : board.tiles[x];} |
|
|
} |
|
|
} |
|
|
if (t == 2){break;} |
|
|
if (t == 2){break;} |
|
|
|
|
|
|
|
|
|
|
|
int test = 1; |
|
|
|
|
|
for (int i = 0; i < board.height * board.width; i++){if(board.tiles[i] == BLOCK){test = 0; break;}} |
|
|
|
|
|
if(test){printf("You Win!"); getchar(); break;} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|