Ejemplo n.º 1
0
# Start the environment
NUM_CREEPS = 30
game = WaterWorld(width=500, height=500, num_creeps=NUM_CREEPS)

p = PLE(game,
        fps=30,
        display_screen=True,
        add_noop_action=False,
        force_fps=False)
game.ple = p
p.init()

# Start the agent
action_set = p.getActionSet()
agent = QLearnerEvolver(len(action_set))
p.state_preprocessor = agent.process_state

#agent.load("model.h5")
#agent.epsilon = 0.05

fail, catch, j = 0, 0, 0
best_score = -np.inf
nb_games = 1

while 1:
    j += 1

    # On réinitialise de temps en temps
    if p.game_over() or j == 50000:
        fail, catch, j = 0, 0, 0
        best_score = max(best_score, p.score())