Replay episodes forever using the supplied action picker.
(env, get_action)
| 134 | |
| 135 | |
| 136 | def 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}") |
no test coverage detected