|
@ -14,6 +14,7 @@ |
|
|
#define EASY 7 |
|
|
#define EASY 7 |
|
|
#define NORMAL 5 |
|
|
#define NORMAL 5 |
|
|
#define HARD 3 |
|
|
#define HARD 3 |
|
|
|
|
|
#define OFFSET_NUM_CHARS 48 |
|
|
#pragma endregion |
|
|
#pragma endregion |
|
|
|
|
|
|
|
|
#pragma region Funktion_heads |
|
|
#pragma region Funktion_heads |
|
@ -94,7 +95,7 @@ void game_minesweeper(){ |
|
|
int bombs = open_tile(&board, x); |
|
|
int bombs = open_tile(&board, x); |
|
|
if(bombs == -1){printf("You Lose!"); getchar(); break;} |
|
|
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 + OFFSET_NUM_CHARS;} |
|
|
} |
|
|
} |
|
|
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];} |
|
|
} |
|
|
} |
|
@ -242,7 +243,7 @@ void open_empty_space(Minesweeper_Board *board, int tile, int index){ |
|
|
int check_tile = is_Valid_tile(board, tile, i); |
|
|
int check_tile = is_Valid_tile(board, tile, i); |
|
|
if(check_tile == -1){continue;} |
|
|
if(check_tile == -1){continue;} |
|
|
int sum = open_tile(board, check_tile); |
|
|
int sum = open_tile(board, check_tile); |
|
|
if(sum != 0){board->tiles[check_tile] = sum + 48;} |
|
|
|
|
|
|
|
|
if(sum != 0){board->tiles[check_tile] = sum + OFFSET_NUM_CHARS;} |
|
|
else if(!array_contains_value(board->marked, check_tile, board->height * board->width)){open_empty_space(board, check_tile, index + 1);} |
|
|
else if(!array_contains_value(board->marked, check_tile, board->height * board->width)){open_empty_space(board, check_tile, index + 1);} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|