def reset_board(self): self.board = CheckerBoard() self.board.printBoard() self.state = GameState(GameState.WhitesTurn) self.last_clicked = None #Reset the AI to the correct settings if self.ai_active and self.ai_color == Player.WHITE: self.white_player = Player.AI_Player(Player.WHITE, self) self.black_player = Player.Human_Player(Player.BLACK) elif self.ai_active and self.ai_color == Player.BLACK: self.white_player = Player.Human_Player(Player.WHITE) self.black_player = Player.AI_Player(Player.BLACK, self) else: self.white_player = Player.Human_Player(Player.WHITE) self.black_player = Player.Human_Player(Player.BLACK)
def __init__(self): self.board = CheckerBoard() self.view = CheckersGUI(self) self.state = GameState(GameState.WhitesTurn) self.white_player = Player.Human_Player(Player.WHITE) self.black_player = Player.AI_Player(Player.BLACK, self) self.white_win_count = 0 self.black_win_count = 0
def __init__(self): self.board = CheckerBoard() self.view = CheckersGUI(self) self.state = GameState(GameState.WhitesTurn) self.white_player = Player.Human_Player(Player.WHITE) self.black_player = Player.AI_Player(Player.BLACK, self) self.white_win_count = 0 self.black_win_count = 0 self.last_clicked = None self.ai_active = True self.ai_color = Player.BLACK
def set_ai(self, ai_state): self.ai_active = ai_state #If turning AI on and white is the AI player, set white player to AI and #black player to human if self.ai_active and self.ai_color == Player.WHITE: self.white_player = Player.AI_Player(Player.WHITE, self) self.black_player = Player.Human_Player(Player.BLACK) #If its whites turn, since white is AI, have white take its turn if self.state.get_state() == GameState.WhitesTurn: self.white_player.turn(self.board, self.state) elif self.ai_active and self.ai_color == Player.BLACK: self.white_player = Player.Human_Player(Player.WHITE) self.black_player = Player.AI_Player(Player.BLACK, self) if self.state.get_state() == GameState.BlacksTurn: self.black_player.turn(self.board, self.state) #If ai is off set both players to human else: self.white_player = Player.Human_Player(Player.WHITE) self.black_player = Player.Human_Player(Player.BLACK)