Created
November 24, 2014 04:10
-
-
Save anonymous/46e1f1edea5c56be0b4d to your computer and use it in GitHub Desktop.
This file contains 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
UNKNOWN = "*" | |
BOMB = "B" | |
GRID_SIZE = 5 | |
def init1(): | |
return [[UNKNOWN] * GRID_SIZE] * GRID_SIZE | |
def init2(): | |
grid = [] | |
for i in range(GRID_SIZE): | |
row = [UNKNOWN] * GRID_SIZE | |
grid.append(row) | |
return grid | |
def p(g): [print(line) for line in g]; print() | |
grid1 = init1() | |
grid2 = init2() | |
p(grid1) | |
p(grid2) | |
grid1[1][3] = BOMB | |
grid2[1][3] = BOMB | |
p(grid1) | |
p(grid2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment