Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Challenge 0002: Minesweeper #9

dcordero opened this issue Feb 12, 2016 · 0 comments

Challenge 0002: Minesweeper #9

dcordero opened this issue Feb 12, 2016 · 0 comments


Copy link

@dcordero dcordero commented Feb 12, 2016

Have you ever played Minesweeper? This cute little game comes with a certain operating system whose name we can't remember. The goal of the game is to find where all the mines are located within a M x N field.
The game shows a number in a square which tells you how many mines there are adjacent to that square. Each square has at most eight adjacent squares. The 4 x 4 field on the left contains two mines, each represented by a '*' character. If we represent the same field by the hint numbers described above, we end up with the field on the right:




The input will consist in a couple of integers n and m (0 < n, m <= 100) which stand for the number of lines and columns of the field, respectively. Followed by a matrix which contains exactly the characters representing the field.
Safe squares are denoted by "." and mine squares by "*", both without the quotes.


A matrix replacing all the "." characters by the number of mines adjacent to that square.

Sample Results

Input   Output
4 4     
*...    *100
....    2210
.*..    1*10
....    1110

Input   Output
3 5
**...    **100
.....    33200
.*...    1*100


This problem appeared originally in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant