MCPcopy Index your code
hub / github.com/rlcode/reinforcement-learning / run_test_loop

Function run_test_loop

3-atari/env.py:136–148  ·  view source on GitHub ↗

Replay episodes forever using the supplied action picker.

(env, get_action)

Source from the content-addressed store, hash-verified

134
135
136def run_test_loop(env, get_action):
137 """Replay episodes forever using the supplied action picker."""
138 while True:
139 obs, _ = env.reset()
140 done = False
141 score = 0.0
142 while not done:
143 quit_if_window_closed(env)
144 action = get_action(np.asarray(obs))
145 obs, reward, terminated, truncated, _ = env.step(action)
146 done = terminated or truncated
147 score += reward
148 print(f"test score: {score}")

Callers 2

2-ppo.pyFile · 0.90
1-dqn.pyFile · 0.90

Calls 3

quit_if_window_closedFunction · 0.70
resetMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected