Skip to content

Commit e62b90d

Browse files
authored
Merge pull request #354 from MarcCote/add_seed_tw_play
Add seed tw play
2 parents 9100860 + 7b82a07 commit e62b90d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎scripts/tw-play‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def build_parser():
1919
choices=["random", "human", "random-cmd", "walkthrough"],
2020
help="Select an agent to play the game: %(choices)s."
2121
" Default: %(default)s.")
22+
parser.add_argument("--seed", type=int, metavar="SEED",
23+
help="Random seed for the game.")
2224
parser.add_argument("--max-steps", type=int, default=0, metavar="STEPS",
2325
help="Limit maximum number of steps.")
2426
parser.add_argument("--viewer", metavar="PORT", type=int, nargs="?", const=6070,
@@ -38,6 +40,7 @@ def main():
3840
args.verbose = args.very_verbose
3941

4042
env = textworld.start(args.game)
43+
env.seed(args.seed)
4144

4245
if args.mode == "random":
4346
agent = textworld.agents.NaiveAgent()

0 commit comments

Comments
 (0)