MCPcopy Create free account
hub / github.com/rlcode/reinforcement-learning / run_test_loop

Function run_test_loop

4-atari-hard/env.py:228–240  ·  view source on GitHub ↗

Replay episodes forever using the supplied action picker (single env).

(env, get_action)

Source from the content-addressed store, hash-verified

226
227
228def run_test_loop(env, get_action):
229 """Replay episodes forever using the supplied action picker (single env)."""
230 while True:
231 obs, _ = env.reset()
232 done = False
233 score = 0.0
234 while not done:
235 quit_if_window_closed(env)
236 action = get_action(np.asarray(obs))
237 obs, reward, terminated, truncated, _ = env.step(action)
238 done = terminated or truncated
239 score += reward
240 print(f"test score: {score}")

Callers

nothing calls this directly

Calls 3

quit_if_window_closedFunction · 0.70
resetMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected