The deadline for this lab is Wednesday 21 November 2007, 11:45:59 hours. Strictly no submissions will be accepted after the deadline.
Each square can either be empty, or it can contain a mine.
The contents of the sample text file is shown below:
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
This can be printed on the screen in the following format, where we use a full-stop (or period) to indicate an empty square, and an asterisk to indicate a mine.
.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *****.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *****.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* .............................. .............................. .............................. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*.
Suppose there is just one mine as shown below:
..... ..... ..*.. ..... .....
We place hints on empty squares that are adjacent to mines; squares that are not adjacent to mines will remain unchanged. After placing the hints, the board will look like this:
..... .111. .1*1. .111. .....The “1” indicates that there is a mine adjacent to the empty square.
Here is a more complicated example. Before placing the hints:
.*.*.*. *****.* .*.*.*. *****.*
After placing the hints:
3*5*4*2 *****4* 5*8*6*3 *****3*
===== Begin Sample Output ===== Before placing hints: .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *****.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *****.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* .............................. .............................. .............................. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. .*.*.*.*.*.*.*.*.*.*.*.*.*.*.* *.*.*.*.*.*.*.*.*.*.*.*.*.*.*. After placing hints: 2*3*3*3*3*3*3*3*3*3*3*3*3*3*3* *4*4*4*4*4*4*4*4*4*4*4*4*4*4*3 4*6*5*4*4*4*4*4*4*4*4*4*4*4*4* *****4*4*4*4*4*4*4*4*4*4*4*4*3 5*8*6*4*4*4*4*4*4*4*4*4*4*4*4* *****4*4*4*4*4*4*4*4*4*4*4*4*3 3*5*4*3*3*3*3*3*3*3*3*3*3*3*3* 112121212121212121212121212121 .............................. 112121212121212121212121212121 2*3*3*3*3*3*3*3*3*3*3*3*3*3*3* *4*4*4*4*4*4*4*4*4*4*4*4*4*4*3 3*4*4*4*4*4*4*4*4*4*4*4*4*4*4* *4*4*4*4*4*4*4*4*4*4*4*4*4*4*3 3*4*4*4*4*4*4*4*4*4*4*4*4*4*4* *3*3*3*3*3*3*3*3*3*3*3*3*3*3*2 ===== End Sample Output =====
You are reminded to follow the sample output exactly; else marks will be deducted.
We will test your programs with other (more complicated) text input files.
Do not use any structures or any form of dynamic memory allocation (using malloc or calloc) in your program, else no credit will be given.
Remember to submit your program frequently using the submit msweeper.c command, and check your submission using the check command.
All the best!