Esempio n. 1
0
            self._ask_move()

    def _ask_move(self):
        
        player = (self.black_player if self.next_move == BLACK_COLOR 
                        else self.white_player)        
        
        move = None        
        while not move:
            move = player.make_move(self.board.copy())
            
            try:
                self.board.make_move(move)            
            except InvalidMoveError:
                move = None
                player.notify_invalid_move()
        
        self.next_move = (WHITE_COLOR if self.next_move == BLACK_COLOR 
                                else BLACK_COLOR)
    
    def finish(self):
        """ Tells the game to stop asking for moves. """
        self._finish = True
        
        

if __name__ == "__main__":
    
    game = Game(AlphaBetaPlayer("white", "dx9", DepthManager(9) , AdvacedGoEvaluator(False)),
                AlphaBetaPlayer("black", "chacholano", DepthManager(9), AdvacedGoEvaluator(False)), Board(9), 0)
    game.play()