From 0269da8773ac9fe267da14eda1146c40af14a7d4 Mon Sep 17 00:00:00 2001 From: Nadav Bhonker Date: Wed, 31 Jan 2018 12:24:02 +0200 Subject: [PATCH] make python_example py3 compatible --- doc/examples/python_example.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/examples/python_example.py b/doc/examples/python_example.py index 486aedc..c202721 100755 --- a/doc/examples/python_example.py +++ b/doc/examples/python_example.py @@ -10,7 +10,7 @@ from rle_python_interface import RLEInterface if len(sys.argv) < 2: - print 'Usage:', sys.argv[0], 'rom_file', 'core_file' + print('Usage:', sys.argv[0], 'rom_file', 'core_file') sys.exit() rle = RLEInterface() @@ -38,12 +38,12 @@ minimal_actions = rle.getMinimalActionSet() # Play 10 episodes -for episode in xrange(10): +for episode in range(10): total_reward = 0 while not rle.game_over(): a = minimal_actions[randrange(len(minimal_actions))] # Apply an action and get the resulting reward reward = rle.act(a) total_reward += reward - print 'Episode', episode, 'ended with score:', total_reward + print('Episode', episode, 'ended with score:', total_reward) rle.reset_game()