Minesweeper is a logic game found on most OS's. The goal of the game is to determine where the mines are on a grid, given numbers indicating the number of mines around that spot.
Given a grid size, and a set of mines, generate the Minesweeper grid for that set of mines.
Input: Two integers indicating the grid size, and an undefined number of integers indicating the mine positions. Positions will be given as (column position, row position), and the indexes will start at row 1.
Output: The Minesweeper grid. If there are no mines around a block, print an
x. For each new row, print a newline. Please output all mines as an asterisk
*. Do not leave any whitespace between the values in the row when printing.
Input "5 5 1 3 3 5 2 4":
xxxxx 11xxx *21xx 2*21x 12*1x
Input "3 4 3 1 1 4 2 3 3 2":
x2* 13* 2*2 *21
Shortest code wins.