Ejemplo n.º 1
0
            else:
                print('Its a draw!')
            sys.exit()
        if (game.getPlayerOneTurn()):
            game.printGameState()
            coordinates = input(
                'Where do you want to place your brick? (row col): \n').split(
                    ' ')
            while len(coordinates) is not 2:
                print("Input two values")
                coordinates = input(
                    'Where do you want to place your brick? (row col): \n'
                ).split(' ')
            x = int(coordinates[0]) - 1
            y = int(coordinates[1]) - 1
            while not game.placeDisk(Move(x, y)):
                print("Invalid input, try again")
                coordinates = input(
                    'Where do you want to place your brick? (row col): \n'
                ).split(' ')
                x = int(coordinates[0]) - 1
                y = int(coordinates[1]) - 1
        else:
            print("I am using my superbrain now...")
            ai = AI()
            aiGame = copy.deepcopy(game)
            action = ai.minimax(aiGame, depth)
            game.placeDisk(action['move'])

            print('I placed in: ' + str(action['move'].getX() + 1) + ' ' +
                  str(action['move'].getY() + 1))