Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def plotTable(m, n):
- table = []
- for h in range(m):
- for w in range(n):
- table.append([h, w])
- return table
- def getMine(bomb):
- counter = 0
- mines = []
- while counter < bomb:
- mine = input().split(',')
- mines.append([int(mine[0]), int(mine[1])])
- counter += 1
- return mines
- def plotMines(table, mines):
- for mine in mines:
- table[table.index(mine)] = 'mine'
- return table
- def printTable(table, m, n):
- counter = 0
- for h in range(1, m + 1):
- for w in range(1, n + 1):
- if table[counter] == 'mine': print('*', end='')
- else: print(0, end='')
- counter += 1
- print()
- table = input().split('x')
- m, n = int(table[0]), int(table[1])
- bomb = int(input())
- mines = getMine(bomb)
- table = plotTable(m, n)
- newTable = plotMines(table, mines)
- printTable(newTable, m, n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement