From 010ed1e7f5cf6372375602f9bacb366367f5723c Mon Sep 17 00:00:00 2001 From: Jakub Kliszko Date: Sat, 8 Apr 2023 20:00:00 +0200 Subject: [PATCH] fix: game board printing --- lab2/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lab2/main.py b/lab2/main.py index 6e5f716d..014b9963 100644 --- a/lab2/main.py +++ b/lab2/main.py @@ -158,7 +158,7 @@ class Game: def print_board(self): """Print the board in the console""" - def get_piece_code(self, pos, background): + def get_piece_code(pos, background): """Return code piece""" if (*pos, False) in self.white_positions: return "w" @@ -178,7 +178,7 @@ class Game: for row in range(self.board_size*4): for col in range(self.board_size): background = "#" if col % 2 == (row//4) % 2 else " " - checker = get_piece_code(col, row//4, background) + checker = get_piece_code((col, row//4), background) if col == 0: if line % 4 == 2: @@ -349,7 +349,8 @@ class Game: has_moved = False possible_moves = self.get_possible_moves(color) while not has_moved: - user_input = input('How do you want to move? (format: d6 e5)\n') + user_input = input( + f'You are {color}. How do you want to move? (format: d6 e5)\n') regex = r"^[a-z]\d+\s[a-z]\d+$" match = re.search(regex, user_input) if not match: