Esempio n. 1
0
def main():
    (options, args) = create_parser().parse_args()
    K = input()

    ### GENERATE THE BOARD ###
    board = []
    if options.rand_board == 0:
        for i in xrange(K):
            s = raw_input("Enter row: \n")
            board += [int(x) for x in s.split(' ')]
    else : board = randomBoard(K)

    testGame = ParatroopersGame(K,board)
    print "Board:"
    testGame.printBoard()

    ### CREATE AGENTS ###
    agent1 = create_agent(options.agent1,ParatroopersGame.PLAYER1, options.time_per_move)
    agent2 = create_agent(options.agent2,ParatroopersGame.PLAYER2, options.time_per_move)

    ### CREATE GAME SIMULATOR ###
    gameSimulator = GameSimulator(testGame, (agent1, agent2), 10)
    if options.verbose==False : gameSimulator.setSilent()

    ### RUN GAME SIMULATION ###
    rankTwoAgents(testGame, gameSimulator,agent1,agent2, sim_count= options.num_sim)
Esempio n. 2
0
def testGameSim():
    """ Example of game simulation """
    testGame = ParatroopersGame(5,randomBoard(5))
    testGame.printBoard()
    import UCT
    agent2 = UCT.UCTAgent(paratroopersGreedyHeuristicVector, ParatroopersGame.PLAYER1, 3, UCT.UCTAgent.UCBPolicyMod)
    agent1 = UCT.UCTAgent(paratroopersGreedyHeuristicVector, ParatroopersGame.PLAYER2, 3, transpositions = False)#, UCT.UCTAgent.EGreedyPolicy())
    gameSimulator = GameSimulator(testGame, (agent2, agent1), 10)
    gameSimulator.playGame()