|
|
@ -247,16 +247,17 @@ void open_empty_space(Minesweeper_Board *board, int tile, int index){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int is_Valid_tile(Minesweeper_Board *board, int tile, int i){ |
|
|
|
//0 = up-left, 1 = down-left, 2 = mid-left, 3 = up-mid, 4 = down-mid, 5 = mid-right, 6 = up-right, 7 = down-right |
|
|
|
int is_Valid_tile(Minesweeper_Board *board, int tile, int direction){ |
|
|
|
int check_tile = tile; |
|
|
|
|
|
|
|
if(i < 3){if(tile % board->width == 0){return -1;} |
|
|
|
if(direction < 3){if(tile % board->width == 0){return -1;} |
|
|
|
else{check_tile -= 1;}} |
|
|
|
if(i > 4){if(tile % board->width + 1 == board->width){return -1;} |
|
|
|
if(direction > 4){if(tile % board->width + 1 == board->width){return -1;} |
|
|
|
else{check_tile += 1;}} |
|
|
|
if(i % 3 == 0){if(tile / board->width == 0){return -1;} |
|
|
|
if(direction % 3 == 0){if(tile / board->width == 0){return -1;} |
|
|
|
else{check_tile -= board->width;}} |
|
|
|
if(i % 3 == 1){if(tile / board->width + 1 == height){return -1;} |
|
|
|
if(direction % 3 == 1){if(tile / board->width + 1 == height){return -1;} |
|
|
|
else{check_tile += board->width;}} |
|
|
|
|
|
|
|
return check_tile; |