You shouldn't be using double-underscore double-underscore variables. If you want to suggest that an instance variable is private, use a name with a single underscore.
You shouldn't be using double-underscore variables. If you want to suggest that an instance variable is private, use a name with a single underscore.
You shouldn't be using double-underscore variables. If you want to suggest that an instance variable is private, use a name with a single underscore.
- 145.5k
- 22
- 190
- 479
def __str__(self):
return "\n".join(
[''.join(
['#' if row[col]cell else '.' for colcell in row]
) for row in self._board]
) + "\n"
def __str__(self):
return "\n".join(
[''.join(
['#' if row[col] else '.' for col in row]
) for row in self._board]
) + "\n"
def __str__(self):
return "\n".join(
[''.join(
['#' if cell else '.' for cell in row]
) for row in self._board]
) + "\n"
board = Board.load('boardFile.dat')
# or...
# board = Board(15)
# board.fill(row=7, col=7)
game = GameOfLifeGenerator(board)
for _ in range(11):
print(board)
board = game.next()
Alternatively,
from itertools import islice
board = Board(15)
board.fill(row=7, col=7)
for state in islice(GameOfLifeGenerator(board), 11):
print(state)
board = Board.load('boardFile.dat')
# or...
# board = Board(15)
# board.fill(row=7, col=7)
game = GameOfLifeGenerator(board)
for _ in range(11):
print(board)
board = game.next()
board = Board.load('boardFile.dat')
game = GameOfLifeGenerator(board)
for _ in range(11):
print(board)
board = game.next()
Alternatively,
from itertools import islice
board = Board(15)
board.fill(row=7, col=7)
for state in islice(GameOfLifeGenerator(board), 11):
print(state)