Display game board with Board.show_board()
This commit is contained in:
parent
7b49cac308
commit
3784faeaed
2 changed files with 14 additions and 3 deletions
|
@ -216,6 +216,18 @@ class Board:
|
|||
else:
|
||||
return '.'
|
||||
|
||||
def show_board(self):
|
||||
display = " |"
|
||||
for x in range(self.get_board_size()):
|
||||
display += "{}|".format(str(x))
|
||||
display += "\n"
|
||||
for x in range(self.get_board_size()):
|
||||
display += "{}|".format(str(x))
|
||||
for y in range(self.get_board_size()):
|
||||
display += "{}|".format(self._piece2str(self._board[x][y]))
|
||||
display += "\n"
|
||||
return display
|
||||
|
||||
def __str__(self):
|
||||
toreturn=""
|
||||
for l in self._board:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue