예제 #1
0
    deck = np.arange(-5, 11)
    done = False
    api = Api()
    actionspace = np.arange(1, 16)
    while not done:

        random_action = 0
        while random_action == 0:
            random_action = np.random.choice(actionspace)
        actionspace[random_action - 1] = 0

        env_action = 0
        while env_action == 0:
            env_action = np.random.choice(deck)
        deck[env_action + 5] = 0
        done, bot_action, bot_score, random_score = api.do_action(
            random_action, env_action)

        print("Bot Score: " + str(bot_score))
        print("Random policy Score: " + str(random_score))
        print("")

        if all(a == 0 for a in actionspace):
            done = True
            if bot_score > random_score:
                botscore += 1
            if bot_score < random_score:
                randomscore += 1
            if bot_score == random_score:
                draw += 1
            print("")
            print("Bot: " + str(botscore))