make the board show function look a lot better
This commit is contained in:
parent
a403dcf0d6
commit
a7f9e68939
1 changed files with 16 additions and 9 deletions
25
blokus.py
25
blokus.py
|
|
@ -34,27 +34,34 @@ def print_game_state(game_state: tuple[game.Board, list[int], list[int]]):
|
|||
(board, p1tiles, p2tiles) = game_state
|
||||
|
||||
barr = []
|
||||
for i in range(BOARD_SIZE):
|
||||
barr.append([])
|
||||
for j in range(BOARD_SIZE):
|
||||
barr[i].append(board[(j, i)])
|
||||
for y in range(BOARD_SIZE):
|
||||
row = []
|
||||
for x in range(BOARD_SIZE):
|
||||
row.append(board[(x, y)])
|
||||
barr.append(row)
|
||||
|
||||
print(f" {'-' * BOARD_SIZE} ")
|
||||
print(f" {'--' * BOARD_SIZE} ")
|
||||
for row in barr:
|
||||
print(
|
||||
f"|{
|
||||
''.join(
|
||||
[
|
||||
' ' if x == 0 else 'X' if x == 1 else 'O' if x == 2 else 'S'
|
||||
' '
|
||||
if x == 0
|
||||
else '\033[93m██\033[00m'
|
||||
if x == 1
|
||||
else '\033[94m██\033[00m'
|
||||
if x == 2
|
||||
else '██'
|
||||
for x in row
|
||||
]
|
||||
)
|
||||
}|"
|
||||
)
|
||||
print(f" {'-' * BOARD_SIZE} ")
|
||||
print(f" {'--' * BOARD_SIZE} ")
|
||||
|
||||
print(f"Player 1 tiles left: {p1tiles}")
|
||||
print(f"Player 2 tiles left: {p2tiles}")
|
||||
print(f"\033[93mPlayer 1\033[00m tiles left: {p1tiles}")
|
||||
print(f"\033[94mPlayer 2\033[00m tiles left: {p2tiles}")
|
||||
|
||||
|
||||
def plot_losses(loss_history, out_path="loss_curve.png"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue