UVa 10189 - Minesweeper

Summary
Given a board with mine locations figure out where the number of mines there should be in each box.

Explanation
This is mostly an implementation question. The most simple way to do this is to reset your matrix and just add to all adjacent cells if a mine is found and also tag whether or not a cell is a mine or not. Go through the matrix and output the number of mines in the cell if the cell is not a mine.

Input
4 4 .... .*.. .... 3 5 ..... .*... 0 0

Output
Field #1: 2210 1*10 1110
 * 100

Field #2: 33200 1*100
 * 100

Solutions
C: http://snippets.dzone.com/posts/show/5205

C++: http://www.lukejduncan.com/2009/08/uva-10189---minesweeper.php