|
|
@ -179,6 +179,41 @@ void distribute_mines(char** mines, int height, int width, int num_mines) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void show_minefield(char** minefield, int height, int width) { |
|
|
|
int i, j; |
|
|
|
|
|
|
|
printf("\n\n"); |
|
|
|
printf(" "); |
|
|
|
for (i = 0; i < height; i++) { |
|
|
|
printf("%3d", i + 1); |
|
|
|
} |
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
printf(" "); |
|
|
|
for (i = 0; i < width; i++) { |
|
|
|
printf("---"); |
|
|
|
} |
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
for (i = 0; i < height; i++) { |
|
|
|
printf("%3d|", i + 1); |
|
|
|
for (j = 0; j < width; j++) { |
|
|
|
printf("%3c", minefield[i][j]); |
|
|
|
} |
|
|
|
printf(" |%-3d\n", i + 1); |
|
|
|
} |
|
|
|
printf(" "); |
|
|
|
for (i = 0; i < width; i++) { |
|
|
|
printf("---"); |
|
|
|
} |
|
|
|
printf("\n"); |
|
|
|
printf(" "); |
|
|
|
for (i = 0; i < width; i++) { |
|
|
|
printf("%3d", i + 1); |
|
|
|
} |
|
|
|
printf("\n\n"); |
|
|
|
} |
|
|
|
|
|
|
|
int minesweeper() { |
|
|
|
int height, width, row, column; |
|
|
|
printf("Enter the height of the game field:\n"); |
|
|
|