microsoft / TextWorld

​TextWorld is a sandbox learning environment for the training and evaluation of reinforcement learning (RL) agents on text-based games.
Other
1.23k stars 188 forks source link

Error when deciding not to quit a game with `tw-play` #168

Closed bentrevett closed 5 years ago

bentrevett commented 5 years ago

I understand this is probably not the most important bug to fix, but I found it while manually inspecting some generated games.

To reproduce, first create a game with:

tw-make custom --world-size 5 --nb-objects 10 --quest-length 5 --seed 1234 --output tw_games/custom_game.ulx

Then begin to play the game with:

tw-play tw_games/custom_game.ulx

Immediately try and quit the game with "q" or "quit", when it asks "Are you sure you want to quit?" type either "n" or "no". This produces the error:

Traceback (most recent call last):
  File "/home/ben/miniconda3/envs/pytorch10/bin/tw-play", line 82, in <module>
    main()
  File "/home/ben/miniconda3/envs/pytorch10/bin/tw-play", line 69, in main
    game_state, reward, done = env.step(command)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/envs/glulx/git_glulx_ml.py", line 541, in step
    self.game_state = self.game_state.update(command, output)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/envs/glulx/git_glulx_ml.py", line 256, in update
    i7_events, game_state._feedback = _detect_i7_events_debug_tags(output)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/envs/glulx/git_glulx_ml.py", line 139, in _detect_i7_events_debug_tags
    open_tags.remove(tag_name)
ValueError: list.remove(x): x not in list
tavianator commented 5 years ago

Thanks for the report! I believe #169 should fix it, let me know if it doesn't.

bentrevett commented 5 years ago

Works for me! Thanks for the fix.