Skip to content

Commit

Permalink
Merge pull request google-deepmind#988 from NightMachinery:master
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 500691669
Change-Id: I8900f86d97b8f49262abe1077d7866f606f39452
  • Loading branch information
lanctot committed Jan 9, 2023
2 parents 434a1cb + 56af2b7 commit 521d01a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions open_spiel/python/algorithms/tabular_qlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@


def valuedict():
# The default factory is called without arguments to produce a new value when
# a key is not present, in __getitem__ only. This value is added to the dict,
# so modifying it will modify the dict.
return collections.defaultdict(float)


Expand Down
4 changes: 2 additions & 2 deletions open_spiel/python/examples/tic_tac_toe_dqn_vs_tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

flags.DEFINE_integer("num_episodes", int(5e4), "Number of train episodes.")
flags.DEFINE_boolean(
"iteractive_play", True,
"interactive_play", True,
"Whether to run an interactive play with the agent after training.")


Expand Down Expand Up @@ -135,7 +135,7 @@ def main(_):
r_mean = eval_against_random_bots(env, agents, random_agents, 1000)
logging.info("Mean episode rewards: %s", r_mean)

if not FLAGS.iteractive_play:
if not FLAGS.interactive_play:
return

# Play from the command line against the trained DQN agent.
Expand Down
8 changes: 5 additions & 3 deletions open_spiel/python/examples/tic_tac_toe_qlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@

flags.DEFINE_integer("num_episodes", int(5e4), "Number of train episodes.")
flags.DEFINE_boolean(
"iteractive_play", True,
"Whether to run an interactive play with the agent after training.")
"interactive_play",
True,
"Whether to run an interactive play with the agent after training.",
)


def pretty_board(time_step):
Expand Down Expand Up @@ -120,7 +122,7 @@ def main(_):
for agent in agents:
agent.step(time_step)

if not FLAGS.iteractive_play:
if not FLAGS.interactive_play:
return

# 2. Play from the command line against the trained agent.
Expand Down

0 comments on commit 521d01a

Please sign in to comment.