Display game board with Board.show_board()

This commit is contained in:
Yorick Barbanneau 2023-12-15 01:43:44 +01:00
parent 7b49cac308
commit 3784faeaed
2 changed files with 14 additions and 3 deletions

View file

@ -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: