game.new_episode() game_state = game.get_state() misc = game_state.game_variables # [KILLCOUNT, AMMO, HEALTH] prev_misc = misc action_size = game.get_available_buttons_size() img_rows, img_cols = 64, 64 img_channels = 3 # Color Channels # Convert image into Black and white trace_length = 4 # RNN states state_size = (trace_length, img_rows, img_cols, img_channels) agent = A2CAgent(state_size, action_size, trace_length) agent.model = Networks.a2c_lstm(state_size, action_size, agent.value_size, agent.learning_rate) # Start training GAME = 0 t = 0 max_life = 0 # Maximum episode life (Proxy for agent performance) # Buffer to compute rolling statistics life_buffer, ammo_buffer, kills_buffer = [], [], [] for i in range(max_episodes): game.new_episode() game_state = game.get_state() misc = game_state.game_variables prev_misc = misc