-
-
Save peacher5/b6897ea8df663d127a98724ca118dbc6 to your computer and use it in GitHub Desktop.
Minesweeper Elab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| size = [int(x) for x in input().split('x')] | |
| table = [[0] * size[1] for row in range(size[0])] | |
| bombs = [] | |
| for i in range(int(input())): | |
| bomb = [int(x) for x in input().split(',')] | |
| bombs.append(bomb) | |
| for bomb in bombs: | |
| table[bomb[0]][bomb[1]] = '*' | |
| for row in range(bomb[0] - 1, bomb[0] + 2): | |
| if row >= 0 and row < size[0]: | |
| for col in range(bomb[1] - 1, bomb[1] + 2): | |
| if col >= 0 and col < size[1] and table[row][col] != '*': | |
| table[row][col] += 1 | |
| for rows in table: | |
| for i in rows: | |
| print(i, end='') | |
| print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment