diff --git a/board.py b/board.py index 460a9e9..e90ae7b 100644 --- a/board.py +++ b/board.py @@ -6,6 +6,11 @@ class GameBoard: def __init__(self): self.board_state = [None] * 64 + self.show_symbols = True + self.correlation = {f"{chr(65 + col)}{8 - row}": row * 8 + col for row in range(8) for col in range(8)} + self.pieces = [] + self.currently_playing = 'White' + self.set_initial_pieces() def set_initial_pieces(self): """Set the initial pieces on the board""" @@ -33,6 +38,12 @@ def _update_positions(self, piece, start_pos, goal_pos, update): self.pieces.remove(killed_piece) piece.moved = True + def toggle_player(self): + if self.currently_playing == 'White': + self.currently_playing = 'Black' + else: + self.currently_playing = 'White' + def check_for_king(self): """Check if the king is alive on the board""" king_alive = False diff --git a/controller.py b/controller.py index 3d8dd7f..0a794b8 100644 --- a/controller.py +++ b/controller.py @@ -10,7 +10,7 @@ class GameManager: def __init__(self, view): - self.model = None + self.board = None self.view = view self.ai = None self.user_ai = None @@ -36,13 +36,13 @@ def get_menu_choice(self): if selection == '1': num_player = input('Enter number of players [1-2]: ') if num_player == '1': - self.model.ai = True + self.board.ai = True self.user_ai = GameAI(self.model, self.view, "Black", "White") - self.model.show_symbols = self.get_symbol_preference() + self.board.show_symbols = self.get_symbol_preference() self.start_game() elif num_player == '2': - self.model.ai = False - self.model.show_symbols = self.get_symbol_preference() + self.board.ai = False + self.board.show_symbols = self.get_symbol_preference() self.start_game() else: print('Your choice is not valid! Please try again!') @@ -52,7 +52,7 @@ def get_menu_choice(self): pass # game loading stuff goes here i guess elif selection == '3': - self.model.view.clear_console() + self.view.clear_console() sys.exit() else: diff --git a/view.py b/view.py index 3d5da73..6f6c5fb 100644 --- a/view.py +++ b/view.py @@ -53,6 +53,14 @@ def build_box(self, part): return ' \u2560' + '\u2550\u2550\u2550\u256C' * 7 + '\u2550\u2550\u2550\u2563' return ' \u255A' + '\u2550\u2550\u2550\u2569' * 7 + '\u2550\u2550\u2550\u255D' + @staticmethod + def display_message(message): + print(message) + + @staticmethod + def input_prompt(message): + return input(message) + @staticmethod def clear_console(): """