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

Function quit_if_window_closed

3-atari/env.py:123–133  ·  view source on GitHub ↗

Exit cleanly when the user clicks the window's X. No-op on headless runs (no pygame display initialized).

(env)

Source from the content-addressed store, hash-verified

121
122
123def quit_if_window_closed(env):
124 """Exit cleanly when the user clicks the window's X.
125
126 No-op on headless runs (no pygame display initialized).
127 """
128 if not pygame.display.get_init():
129 return
130 for event in pygame.event.get():
131 if event.type == pygame.QUIT:
132 env.close()
133 sys.exit()
134
135
136def run_test_loop(env, get_action):

Callers 2

1-dqn.pyFile · 0.90
run_test_loopFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected