Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
xXUnique31Xx committed Jul 1, 2024
1 parent c1a13b3 commit 1947b00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def get_menu_choice(self):
num_player = GameView.input_prompt('Enter number of players [1-2]: ')
if num_player == '1':
self.ai = True
self.player_white = HumanPlayer('White', self.view)
self.player_black = ComputerPlayer('Black', self.board, self.view, 'White')
self.player_white = HumanPlayer('White', self.view, self)
self.player_black = ComputerPlayer('Black', self.board, self.view, 'White', self)
self.board.show_symbols = self.get_symbol_preference()
self.start_game()
elif num_player == '2':
self.ai = False
self.player_white = HumanPlayer('White', self.view)
self.player_black = HumanPlayer('Black', self.view)
self.player_white = HumanPlayer('White', self.view, self)
self.player_black = HumanPlayer('Black', self.view, self)
self.board.show_symbols = self.get_symbol_preference()
self.start_game()
else:
Expand Down
9 changes: 4 additions & 5 deletions player.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from view import GameView
from algorithm import GameAI
from controller import GameManager


class Player():
Expand All @@ -15,10 +14,10 @@ def make_move(self, board):

class HumanPlayer(Player):

def __init__(self, color, view):
def __init__(self, color, view, game_manager):
super().__init__(color)
self.view = view
self.game_manager = GameManager(view)
self.game_manager = game_manager

def make_move(self, start_pos, goal_pos, board, update=True):
"""Method to make a move."""
Expand All @@ -39,12 +38,12 @@ def make_move(self, start_pos, goal_pos, board, update=True):

class ComputerPlayer(Player):

def __init__(self, color, board, view, enemy):
def __init__(self, color, board, view, enemy, game_manager):
super().__init__(color)
self.is_currently_playing = False
self.game_ai = GameAI(board, view, color, enemy)
self.view = view
self.game_manager = GameManager(view)
self.game_manager = game_manager

def make_move(self, board, update=True):
"""Method to make a move."""
Expand Down

0 comments on commit 1947b00

Please sign in to comment.