Skip to content

Commit 2838cb2

Browse files
committed
Make it runnable with Python3
1 parent 5a5793e commit 2838cb2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

deep_q_network.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def trainNetwork(s, readout, h_fc1, sess):
106106
checkpoint = tf.train.get_checkpoint_state("saved_networks")
107107
if checkpoint and checkpoint.model_checkpoint_path:
108108
saver.restore(sess, checkpoint.model_checkpoint_path)
109-
print "Successfully loaded:", checkpoint.model_checkpoint_path
109+
print("Successfully loaded:", checkpoint.model_checkpoint_path)
110110
else:
111-
print "Could not find old network weights"
111+
print("Could not find old network weights")
112112

113113
epsilon = INITIAL_EPSILON
114114
t = 0
@@ -119,7 +119,7 @@ def trainNetwork(s, readout, h_fc1, sess):
119119
action_index = 0
120120
if t % FRAME_PER_ACTION == 0:
121121
if random.random() <= epsilon:
122-
print "----------Random Action----------"
122+
print("----------Random Action----------")
123123
action_index = random.randrange(ACTIONS)
124124
a_t[random.randrange(ACTIONS)] = 1
125125
else:
@@ -189,9 +189,9 @@ def trainNetwork(s, readout, h_fc1, sess):
189189
else:
190190
state = "train"
191191

192-
print "TIMESTEP", t, "/ STATE", state, \
192+
print("TIMESTEP", t, "/ STATE", state, \
193193
"/ EPSILON", epsilon, "/ ACTION", action_index, "/ REWARD", r_t, \
194-
"/ Q_MAX %e" % np.max(readout_t)
194+
"/ Q_MAX %e" % np.max(readout_t))
195195
# write info to files
196196
'''
197197
if t % 10000 <= 100:

game/wrapped_flappy_bird.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def frame_step(self, input_actions):
8585

8686
# playerIndex basex change
8787
if (self.loopIter + 1) % 3 == 0:
88-
self.playerIndex = PLAYER_INDEX_GEN.next()
88+
self.playerIndex = next(PLAYER_INDEX_GEN)
8989
self.loopIter = (self.loopIter + 1) % 30
9090
self.basex = -((-self.basex + 100) % self.baseShift)
9191

0 commit comments

Comments
 (0)