Giter Club home page Giter Club logo

textworld's Introduction

TextWorld

PyPI version PyPI - Python Version Build Status Documentation Status Join the chat at https://gitter.im/Microsoft/TextWorld

A text-based game generator and extensible sandbox learning environment for training and testing reinforcement learning (RL) agents. Also check out aka.ms/textworld for more info about TextWorld and its creators. Have questions or feedback about TextWorld? Send them to [email protected] or use the Gitter channel listed above.

Installation

TextWorld supports Python 3.9/3.10/3.11/3.12 for Linux and macOS systems only at the moment. For Windows users, docker can be used as a workaround (see Docker section below).

Requirements

TextWorld requires some system libraries for its native components. On a Debian/Ubuntu-based system, these can be installed with

sudo apt update && sudo apt install build-essential libffi-dev python3-dev curl git

And on macOS, with

brew install libffi curl git

Note: We advise our users to use virtual environments to avoid Python packages from different projects to interfere with each other. Popular choices are Conda Environments and Virtualenv

Installing TextWorld

The easiest way to install TextWorld is via pip:

pip install textworld

Or, after cloning the repo, go inside the root folder of the project (i.e. alongside setup.py) and run

pip install .

Visualization

TextWorld comes with some tools to visualize game states. Make sure all dependencies are installed by running

pip install textworld[vis]

Then, you will need to install either the Chrome or Firefox webdriver (depending on which browser you have currently installed). If you have Chrome already installed you can use the following command to install chromedriver

pip install chromedriver_installer

Current visualization tools include: take_screenshot, visualize and show_graph from textworld.render.

Docker

A docker container with the latest TextWorld release is available on DockerHub.

docker pull marccote19/textworld
docker run -p 8888:8888 -it --rm marccote19/textworld

Then, in your browser, navigate to the Jupyter notebook's link displayed in your terminal. The link should look like this

http://127.0.0.1:8888/?token=8d7aaa...e95

Note: See README.md in the docker folder for troubleshooting information.

Usage

Generating a game

TextWorld provides an easy way of generating simple text-based games via the tw-make script. For instance,

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

where custom indicates we want to customize the game using the following options: --world-size controls the number of rooms in the world, --nb-objects controls the number of objects that can be interacted with (excluding doors) and --quest-length controls the minimum number of commands that is required to type in order to win the game. Once done, the game custom_game.z8 will be saved in the tw_games/ folder.

Playing a game (terminal)

To play a game, one can use the tw-play script. For instance, the command to play the game generated in the previous section would be

tw-play tw_games/custom_game.z8

Note: Only Z-machine's games (*.z1 through .z8) and Glulx's games (.ulx) are supported.

To visualize the game state while playing, use the --viewer [port] option.

tw-play tw_games/custom_game.z8 --viewer

A new browser tab should open and track your progress in the game.

Playing a game (Python + Gym-like API)

Here's how you can interact with a text-based game from within Python using a Gym-like API.

import textworld.gym

# Register a text-based game as a new environment.
env_id = textworld.gym.register_game("tw_games/custom_game.z8",
                                     max_episode_steps=50)

env = textworld.gym.make(env_id)  # Start the environment.

obs, infos = env.reset()  # Start new episode.
env.render()

score, moves, done = 0, 0, False
while not done:
    command = input("> ")
    obs, score, done, infos = env.step(command)
    env.render()
    moves += 1

env.close()
print("moves: {}; score: {}".format(moves, score))

Note: To play text-based games without a Gym-like API, see Playing text-based games with TextWorld.ipynb

Documentation

For more information about TextWorld, check the documentation.

Visual Studio Code

You can install the textworld-vscode extension that enables syntax highlighting for editing .twl and .twg TextWorld files.

Notebooks

Check the notebooks provided with the framework to see what you can do with it. You will need the Jupyter Notebook to run them. You can install it with

pip install jupyter

Citing TextWorld

If you use TextWorld, please cite the following BibTex:

@Article{cote18textworld,
  author = {Marc-Alexandre C\^ot\'e and
            \'Akos K\'ad\'ar and
            Xingdi Yuan and
            Ben Kybartas and
            Tavian Barnes and
            Emery Fine and
            James Moore and
            Ruo Yu Tao and
            Matthew Hausknecht and
            Layla El Asri and
            Mahmoud Adada and
            Wendy Tay and
            Adam Trischler},
  title = {TextWorld: A Learning Environment for Text-based Games},
  journal = {CoRR},
  volume = {abs/1806.11532},
  year = {2018}
}

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

textworld's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textworld's Issues

Install errors with PyPI version of TextWorld

I followed the README.md instructions for installing TextWorld from PyPI in a clean environment, and I'm getting a build issue when pip tries to build textworld.

To replicate in a clean Conda environment on macOS:

brew install libffi curl git
conda create --name textworld python=3.7
conda activate textworld
pip install textworld

This fails with the following error:

Successfully built pyyaml urwid hashids jericho pybars3 greenlet gevent gym PyMeta3 future
Failed to build textworld
Installing collected packages: numpy, tqdm, pycparser, cffi, decorator, networkx, pyyaml, urwid, six, more-itertools, tatsu, hashids, jericho, PyMeta3, pybars3, itsdangerous, Werkzeug, MarkupSafe, Jinja2, click, flask, urllib3, selenium, greenlet, gevent, pillow, pyparsing, pydot, wcwidth, prompt-toolkit, idna, chardet, requests, future, pyglet, gym, textworld
  Running setup.py install for textworld ... error
    Complete output from command /Users/leon/miniconda3/envs/textworld/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-record-egmjy2z6/install-record.txt --single-version-externally-managed --compile:
    running install
    Running post install task
    + echo 'Running setup.sh...'
    Running setup.sh...
    ++ uname -s
    + unameOut=Darwin
    + case "${unameOut}" in
    + machine=Mac
    + tatsu textworld/logic/logic.ebnf -o textworld/logic/parser.py -G textworld/logic/model.py
    ------------------------------------------------------------------------
             284  lines in grammar
              44  rules in grammar
             300  nodes in AST
    + tatsu textworld/textgen/textgen.ebnf -o textworld/textgen/parser.py -G textworld/textgen/model.py
    ------------------------------------------------------------------------
              59  lines in grammar
               9  rules in grammar
              46  nodes in AST
    + cd textworld/thirdparty/
    + '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
    + '[' '!' -d inform7-6M62 ']'
    + echo 'Installing Inform7 CLI'
    Installing Inform7 CLI
    + cd inform7-6M62/
    + ./install-inform7.sh --prefix /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/textworld/thirdparty/inform7-6M62
    ./setup.sh: line 39: ./install-inform7.sh: No such file or directory
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/setup.py", line 67, in <module>
        'nose==1.3.7',
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/site-packages/setuptools/__init__.py", line 143, in setup
        return distutils.core.setup(**attrs)
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/setup.py", line 24, in run
        msg="Running post install task")
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 335, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/util.py", line 286, in execute
        func(*args)
      File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/setup.py", line 18, in _pre_install
        check_call(['./setup.sh'], shell=True, cwd=os.getcwd())
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['./setup.sh']' returned non-zero exit status 1.
    
    ----------------------------------------
Command "/Users/leon/miniconda3/envs/textworld/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-record-egmjy2z6/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-1qx6q992/textworld/

It looks like this is the same issue as in #116, which got resolved in #118 (on Jan 25th). The package on PyPI was last updated on Jan 8th, so I think this could be fixed by updating the code on PyPI.

Problem running Handcrafting a game.ipynb

I have a problem running this cell in the Handcrafting a game notebook:
image

This is the output I got after executing the cell:

-= Room A =-
Well I'll be, you are in a place we're calling a Room A.

You smell a fine smell, and follow it to a board. On the board you can make out
an old key, so there's that.

There is a closed door leading east.

There is a note on the floor.

> take key
You take the old key from the board.

> unlock door with key
You unlock door.

> go east
You have to open the door first.

> open door
You open door.

> go east

-= Room B =-
You find yourself in a Room B. A normal one.

You make out a closed case right there by you.

There is an open door leading west.

> open case
You open the case.

> quit
Are you sure you want to quit?

> yes
---------------------------------------------------------------------------
GameNotRunningError                       Traceback (most recent call last)
<ipython-input-9-04e7f04acdef> in <module>
----> 1 quest = M.record_quest()

/opt/conda/envs/tw/lib/python3.6/site-packages/textworld/generator/maker.py in record_quest(self, ask_for_state)
    531             game_file = self.compile(pjoin(tmpdir, "record_quest.ulx"))
    532             recorder = Recorder()
--> 533             textworld.play(game_file, wrapper=recorder)
    534 
    535         # Skip "None" actions.

/opt/conda/envs/tw/lib/python3.6/site-packages/textworld/helpers.py in play(game_file, agent, max_nb_steps, wrapper, silent)
     78         for _ in range(max_nb_steps):
     79             command = agent.act(game_state, reward, done)
---> 80             game_state, reward, done = env.step(command)
     81 
     82             if not silent:

/opt/conda/envs/tw/lib/python3.6/site-packages/textworld/envs/wrappers/recorder.py in step(self, command)
     14 
     15     def step(self, command: str) -> Tuple[GameState, float, bool]:
---> 16         game_state, score, done = super().step(command)
     17         self.actions.append(game_state.action)
     18         self.last_game_state = game_state

/opt/conda/envs/tw/lib/python3.6/site-packages/textworld/core.py in step(self, command)
    280 
    281     def step(self, command: str) -> Tuple[GameState, float, bool]:
--> 282         return self._wrapped_env.step(command)
    283 
    284     def reset(self) -> GameState:

/opt/conda/envs/tw/lib/python3.6/site-packages/textworld/envs/glulx/git_glulx_ml.py in step(self, command)
    515         output = self._send(command)
    516         if output is None:
--> 517             raise GameNotRunningError()
    518 
    519         self.game_state = self.game_state.update(command, output)

GameNotRunningError: Game is not running at the moment. Reset the environment to start a new game using `env.reset()`.

Besides the GameNoteRunningError, I am not able to see list of available actions at each state. I just cloned the repo and did not change any of the preceding cells.

Handling doors and rooms placement during quest generation

If we want to generate doors and rooms as needed during quest generation, we will need to re-think the way we position doors/rooms. Right now, we are assuming symmetric connections between the rooms, maybe we should allow "bends" in the connections e.g.

           RoomB
                 |
RoomA ---/

Also, we might want to consider doors as rooms, i.e. they have exits too (back/front of the door).

Leading and trailing whitespaces get stripped in text grammar

At the moment, when parsing the grammar files, whitespaces found at the start or the end of expansions are getting stripped. This might also been the case with the old way of loading grammar files.

To reproduce the issue:
tw-make custom --quest-breadth 3 --quest-length 3 --seed 24853 --output tw_games/test.ulx
tw-play ./tw_games/test.ulx

Welcome to TextWorld! Here is your task for today. First, it would be good if
you could make an effort to head east.After that,recover the key from the
kitchen. And if you do that, you're the winner!

Note the whitespaces in house_instructions.twg

...
emptyinstruction1: And then, ;
emptyinstruction2: Then, ;
emptyinstruction3: After that, ;
emptyinstruction4: And then, ;
emptyinstruction5: After that, ;
emptyinstruction6: Then, ;
emptyinstruction7: And then, ;
emptyinstruction8: After that, ;
emptyinstruction9: And then, ;
emptyinstruction10: Then, ;

Potential bug? Keycard or rectangular keycard?

I generated a new game and started it. But at a certain point, I get stuck, because I have a keycard that I have to use to open a portal. I can't use that keycard, because I have another, rectangular keycard in my inventory and the game doesn't understand which one I want to use:

examine gateway
it's a solid portal It is closed.

open gateway
You have to unlock the gateway with the key first.

open gateway with keycard
Which do you mean, the keycard or the rectangular keycard?

open gateway with the non rectangular keycard
You can't see any such thing.

open gateway with the rectangular keycard
That doesn't seem to fit the lock.`

Game freezing / general robustness to wrapped game engine

I've noticed that when randomly sampling actions in real text games (e.g. ZMachine games not generated by TextWorld), the game inevitably freezes/segfaults at some point (It seems like Jericho has the same issue). Since TextWorld is a RL environment for text games, can we make it more robust to these problems? For example, having a timeout failure or game crashed failure?

Here's a code snippet that consistently freezes on my machine:

# !mkdir -p games
# !wget -q http://www.ifarchive.org/if-archive/games/zcode/Balances.z5 -O games/Balances.z5

import textworld
import itertools
import tqdm
import numpy as np

np.random.seed(0)
episodes = 50
episode_len = 500

scores = []

for episode in range(episodes):
    print('episode {}'.format(episode))
    env = textworld.start('./games/Balances.z5')
    env.reset()
    env.seed(0)
        
    verbs = [w.word for w in env._jericho.get_dictionary() if w.is_verb]
    nouns = [w.word for w in env._jericho.get_dictionary() if w.is_noun]
    actions = [' '.join(tup) for tup in list(itertools.product(verbs, nouns))]
    
    for step in tqdm.trange(episode_len):
        act = np.random.choice(actions)
        print(step, act)
        game_state, score, done = env.step(act)
        if done:
            break
    scores.append(score)
    
print(scores)

Adding pattern-based propositions (like 'touchable')?

Hey,
How hard would it be to add a pattern based proposition such as touchable (like the native one in Inform7)? So for the simple example of taking an object instead of having to write
take/c, take/s, take for every possible location of o, one could just write touchable(o)?

I seem to remember there being talk of this, but wasn't sure what was decided in the end.

It could be really nice, and add lots of flexibility in writing new rules!

Basic theme is broken.

Hi there,

Trying to create a game with the basic theme instead of the house theme returns with an error in tokenization:

tatsu.exceptions.FailedToken: FailedToken: /path/to/TextWorld/textworld/generator/data/text_grammars/basic_obj.twg(85:35) expecting '|' :
(k<->d)_match:#letter#-#(k)_noun# <-> #letter#-#(d)_noun#

This is encountered irrespective of wheather the game is being made from cli like tw-make custom --theme basic or via the API call of textworld.make(options).

Negation of a state in defining a new command

While defining a new command in the logic file, is it possible to mention that certain state cannot be satisfied? For example, I have a game scenario where, you can ask a information to a person. The question can be asked until the person gives the answer. When the person has given the information, you cannot ask the question again. So, I have defined a predicate "asked(pr)", which represents the state when the question has been asked already. And the rule is "ask/pr(pr)" which will be available only when the question was not asked before. So how can I add not "asked(pr)" state in the rule definition?

Intermediate Rewards and policy commands not working

Hi,

It appears like having policy_commands=True and intermediate_reward=True in infos_to_request leads to bugs. For instance, done and has_won return False even after winning a quest. Here is my test code:

import gym
import textworld.gym

print(textworld.__version__, gym.__version__)
>>> 1.1.1 0.10.4

Let's make a simple game

!tw-make tw-simple --rewards dense --goal brief --seed 1234 --output games/my_game.ulx -v -f
>>> Global seed: 1234
>>> Game generated: ~dir/games/my_game.ulx

>>> Objective:
>>> The dinner is almost ready! It's only missing a grilled half of a bag of chips.

>>> Walkthrough:
>>> open antique trunk > take old key from antique trunk > unlock wooden door with old key > open >>> wooden door > go east > open screen door > go east > go south > take half of a bag of chips > >>> go north > go west > put half of a bag of chips on stove

>>> -= Stats =-
>>> Nb. locations: 6
>>> Nb. objects: 28

Load the game using policy_commands=True and intermediate_reward=True in infos_to_request

max_step = 50
path = ["./games/my_game.ulx"]

infos_to_request = textworld.EnvInfos(
    intermediate_reward=True, policy_commands=True, has_won=True, has_lost=True)

env_id = textworld.gym.register_games(
    path, request_infos=infos_to_request, max_episode_steps=max_step)

env = gym.make(env_id)

Get the optimal sequence of commands from the walkthrough

walkthrough = "open antique trunk > take old key from antique trunk > unlock wooden door with old key > open wooden door > go east > open screen door > go east > go south > take half of a bag of chips > go north > go west > put half of a bag of chips on stove"
policy_cmds = walkthrough.split(' > ')

Play the game using policy commands

indx = 0
all_scores = []
done = False

obs, infos = env.reset()

for indx, cmd in enumerate(policy_cmds):
    obs, score, done, infos = env.step(cmd)
    all_scores.append(score)
    
    print(score, done, infos)

>>> 1 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 2 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 3 >>> False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 4 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 5 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 6 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 7 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 8 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 10 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 10 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 10 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}
>>> 11 False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []}

policy_commands and intermediate_reward return nothing, but there is more

print(done, infos, all_scores)
>>> False {'has_won': False, 'has_lost': False, 'intermediate_reward': 0, 'policy_commands': []} [1, 2, 3, 4, 5, 6, 7, 8, 10, 10, 10, 11]
print(obs)
>>> You put the half of a bag of chips on the stove.
>>> 
>>> Your score has just gone up by one point.
>>> 
>>> 
>>>                                *** The End ***
>>> 
>>> You scored 11 out of a possible 11, in 13 turn(s).
>>> 
>>> 
>>> Would you like to RESTART, RESTORE a saved game, QUIT or UNDO the last command?
>>> > 

According to obs we have won but done and has_won are still False.

Trying the same thing but with policy_commands=False and intermediate_reward=False leads to correct behavior for done and has_won. I tried this using a tw-cooking game and same thing happened. Am I missing something or is this a bug? I upgraded gym to the latest version but it didn't help either.

RuntimeError when running play function with NeuralAgent

Hi,
When running the play function with the Neural Agent I find the following error, I have tried with both cuda and cpu devices but the error still continues. Thank you.

RuntimeError Traceback (most recent call last)
in
----> 1 play(agent, "./games/rewardsDense_goalDetailed.ulx")

in play(agent, path, max_step, nb_episodes, verbose)
33 nb_moves = 0
34 while not done:
---> 35 command = agent.act(obs, score, done, infos)
36 obs, score, done, infos = env.step(command)
37 nb_moves += 1

in act(self, obs, score, done, infos)
149
150 # Get our next action and value prediction.
--> 151 outputs, indexes, values = self.model(input_tensor, commands_tensor)
152 action = infos["admissible_commands"][indexes[0]]
153

~/.local/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
--> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)

in forward(self, obs, commands, **kwargs)
34 nb_cmds = commands.size(1)
35
---> 36 embedded = self.embedding(obs)
37 encoder_output, encoder_hidden = self.encoder_gru(embedded)
38 state_output, state_hidden = self.state_gru(encoder_hidden, self.state_hidden)

~/.local/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
--> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)

~/.local/lib/python3.6/site-packages/torch/nn/modules/sparse.py in forward(self, input)
106 return F.embedding(
107 input, self.weight, self.padding_idx, self.max_norm,
--> 108 self.norm_type, self.scale_grad_by_freq, self.sparse)
109
110 def extra_repr(self):

~/.local/lib/python3.6/site-packages/torch/nn/functional.py in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)
1074 with torch.no_grad():
1075 torch.embedding_renorm_(weight, input, max_norm, norm_type)
-> 1076 return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
1077
1078

RuntimeError: Expected object of type torch.LongTensor but found type torch.cuda.LongTensor for argument #3 'index'

Remove the _is_navigation special check in chaining

With the new and better chaining that supports nonlinear quests, there might not be a use for the special check self._is_navigation(nav_parent.action) when checking for action dependencies. That check was originally added to help generate more interesting (read longer chains) "linear" quest. Once PR #17 is merged, that type of quest could be still generated by decomposing it in multiple subquests.

For instance, take key > go north > unlock chest with key would be decomposed into the following subquests: (take key, go north, unlock chest with key) or maybe (take key, go north > unlock chest with key).

Issue with creating a coin collector example

I'm trying to reproduce the Coin Collector example from the paper:
"Counting to Explore and Generalize in Text-based Games" (https://arxiv.org/abs/1806.11525).

However, I'm having some difficulty getting a basic example working
with default options. Consider the following code:

import textworld.challenges
import textworld
from pdb import set_trace
game_options = textworld.GameOptions()
textworld.challenges.coin_collector.make_game('simple', game_options)

This yields the following error:

  File "/home/prabhatn/mud-rl/textworld/challenges/coin_collector.py", line 93, in make_game
    rngs = options.rngs
  File "/home/prabhatn/mud-rl/textworld/generator/game.py", line 1058, in rngs
    for key, seed in self._seeds.items():
AttributeError: 'NoneType' object has no attribute 'items'

However, the constructor for GameOptions doesn't take in or require a seeds argument.

Anyhow, this can be rectified by adding the line:

game_options.seeds = 5

before the final line that creates the game. However, I then get the error:

  File "/home/prabhatn/mud-rl/textworld/challenges/coin_collector.py", line 143, in make_game
    M.set_quest_from_commands(walkthrough)
  File "/home/prabhatn/mud-rl/textworld/generator/maker.py", line 586, in set_quest_from_commands
    event = Event(actions=actions, conditions=winning_facts)
  File "/home/prabhatn/mud-rl/textworld/generator/game.py", line 92, in __init__
    self.condition = self.set_conditions(conditions)
  File "/home/prabhatn/mud-rl/textworld/generator/game.py", line 111, in set_conditions
    raise UnderspecifiedEventError()
textworld.generator.game.UnderspecifiedEventError: Either the actions or the conditions is needed to create an event.

Further digging suggests that the action space is empty.

Is there any code to reproduce the coin collector example from the paper?

Any help is appreciated.

Broken installation on MacOS + conda

Tried to install on a fresh conda environment (conda=4.5.9, python=3.6.6, OS=High Sierra 10.13.5), but setup.sh returns the following error (when running it with pip):

+ echo 'Running setup.sh...'
Running setup.sh...
+ tatsu textworld/logic/logic.ebnf -o textworld/logic/parser.py -G textworld/logic/model.py
------------------------------------------------------------------------
         249  lines in grammar
          37  rules in grammar
         265  nodes in AST
+ cd textworld/thirdparty/
+ '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
+ '[' '!' -d inform7-6M62 ']'
+ echo 'Installing Inform7 CLI'
Installing Inform7 CLI
+ cd inform7-6M62/
+ ./install-inform7.sh --prefix /Users/nantas/lab/textworld/textworld/thirdparty/inform7-6M62
+ '[' '!' -d frotz ']'
+ cd frotz/
+ make -B dumb
gcc -O2  -o src/common/buffer.o -c src/common/buffer.c
gcc -O2  -o src/common/err.o -c src/common/err.c
gcc -O2  -o src/common/fastmem.o -c src/common/fastmem.c
gcc -O2  -o src/common/files.o -c src/common/files.c
gcc -O2  -o src/common/hotkey.o -c src/common/hotkey.c
gcc -O2  -o src/common/input.o -c src/common/input.c
gcc -O2  -o src/common/main.o -c src/common/main.c
gcc -O2  -o src/common/math.o -c src/common/math.c
gcc -O2  -o src/common/object.o -c src/common/object.c
gcc -O2  -o src/common/process.o -c src/common/process.c
gcc -O2  -o src/common/quetzal.o -c src/common/quetzal.c
gcc -O2  -o src/common/random.o -c src/common/random.c
gcc -O2  -o src/common/redirect.o -c src/common/redirect.c
gcc -O2  -o src/common/screen.o -c src/common/screen.c
gcc -O2  -o src/common/sound.o -c src/common/sound.c
gcc -O2  -o src/common/stream.o -c src/common/stream.c
gcc -O2  -o src/common/table.o -c src/common/table.c
gcc -O2  -o src/common/text.o -c src/common/text.c
gcc -O2  -o src/common/variable.o -c src/common/variable.c

Archiving common code...
/usr/bin/ar rc src/frotz_common.a src/common/buffer.o src/common/err.o src/common/fastmem.o src/common/files.o src/common/hotkey.o src/common/input.o src/common/main.o src/common/math.o src/common/object.o src/common/process.o src/common/quetzal.o src/common/random.o src/common/redirect.o src/common/screen.o src/common/sound.o src/common/stream.o src/common/table.o src/common/text.o src/common/variable.o
/usr/bin/ranlib src/frotz_common.a

gcc -O2 -o src/dumb/dumb_init.o -c src/dumb/dumb_init.c
gcc -O2 -o src/dumb/dumb_input.o -c src/dumb/dumb_input.c
src/dumb/dumb_input.c:129:39: warning: implicit conversion from 'int' to 'char' changes value from 142 to -114 [-Wconstant-conversion]
      case '0': *dest++ = ZC_FKEY_MIN + 9; break;
                        ~ ~~~~~~~~~~~~^~~
src/dumb/dumb_input.c:252:32: warning: passing 'zchar *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
        dumb_discard_old_input(strlen(continued_line_chars));
                                      ^~~~~~~~~~~~~~~~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
src/dumb/dumb_input.c:267:14: warning: field precision should have type 'int', but argument has type 'long' [-Wformat]
          printf("%.*s", next_page - current_page, current_page);
                  ~~^~   ~~~~~~~~~~~~~~~~~~~~~~~~
src/dumb/dumb_input.c:375:10: warning: passing 'zchar *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
  strcat(buf, read_line_buffer);
         ^~~
/usr/include/secure/_string.h:131:27: note: expanded from macro 'strcat'
                __builtin___strcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                        ^~~~
4 warnings generated.
gcc -O2 -o src/dumb/dumb_output.o -c src/dumb/dumb_output.c
gcc -O2 -o src/dumb/dumb_pic.o -c src/dumb/dumb_pic.c

Archiving dumb interface code...
/usr/bin/ar rc src/frotz_dumb.a src/dumb/dumb_init.o src/dumb/dumb_input.o src/dumb/dumb_output.o src/dumb/dumb_pic.o
/usr/bin/ranlib src/frotz_dumb.a

gcc -o dfrotz src/frotz_common.a src/frotz_dumb.a 
+ echo 'Installing cheapglk'
Installing cheapglk
+ cd glulx/cheapglk
+ make -B
cc -g -Wall -Werror -std=gnu99    -c -o cgfref.o cgfref.c
cc -g -Wall -Werror -std=gnu99    -c -o cggestal.o cggestal.c
cc -g -Wall -Werror -std=gnu99    -c -o cgmisc.o cgmisc.c
cc -g -Wall -Werror -std=gnu99    -c -o cgstream.o cgstream.c
cc -g -Wall -Werror -std=gnu99    -c -o cgstyle.o cgstyle.c
cc -g -Wall -Werror -std=gnu99    -c -o cgwindow.o cgwindow.c
cc -g -Wall -Werror -std=gnu99    -c -o cgschan.o cgschan.c
cc -g -Wall -Werror -std=gnu99    -c -o cgdate.o cgdate.c
cc -g -Wall -Werror -std=gnu99    -c -o cgunicod.o cgunicod.c
cc -g -Wall -Werror -std=gnu99    -c -o main.o main.c
cc -g -Wall -Werror -std=gnu99    -c -o gi_dispa.o gi_dispa.c
cc -g -Wall -Werror -std=gnu99    -c -o gi_blorb.o gi_blorb.c
cc -g -Wall -Werror -std=gnu99    -c -o gi_debug.o gi_debug.c
cc -g -Wall -Werror -std=gnu99    -c -o cgblorb.o cgblorb.c
cc -g -Wall -Werror -std=gnu99    -c -o agent.o agent.c
agent.c:54:5: error: '__builtin___memset_chk' will always overflow destination buffer [-Werror,-Wbuiltin-memcpy-chk-size]
    memset(sock_addr.sun_path, 0, 108);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:76:3: note: expanded from macro 'memset'
                __builtin___memset_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
agent.c:55:5: error: '__builtin___strncpy_chk' will always overflow destination buffer [-Werror,-Wbuiltin-memcpy-chk-size]
    strncpy(sock_addr.sun_path, sock_name, 108);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:124:3: note: expanded from macro 'strncpy'
                __builtin___strncpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
agent.c:129:16: error: variable 'dest_buf_len' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
            if(err == EINTR) {
               ^~~~~~~~~~~~
agent.c:178:12: note: uninitialized use occurs here
    return dest_buf_len;
           ^~~~~~~~~~~~
agent.c:129:13: note: remove the 'if' if its condition is always true
            if(err == EINTR) {
            ^~~~~~~~~~~~~~~~~
agent.c:111:8: error: variable 'dest_buf_len' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if(sent < 0) {
       ^~~~~~~~
agent.c:178:12: note: uninitialized use occurs here
    return dest_buf_len;
           ^~~~~~~~~~~~
agent.c:111:5: note: remove the 'if' if its condition is always false
    if(sent < 0) {
    ^~~~~~~~~~~~~~
agent.c:102:8: error: variable 'dest_buf_len' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if(sent < 0) {
       ^~~~~~~~
agent.c:178:12: note: uninitialized use occurs here
    return dest_buf_len;
           ^~~~~~~~~~~~
agent.c:102:5: note: remove the 'if' if its condition is always false
    if(sent < 0) {
    ^~~~~~~~~~~~~~
agent.c:139:5: note: variable 'dest_buf_len' is declared here
    glui32 dest_buf_len = ntohl(net_dest_buf_len);
    ^
5 errors generated.
make: *** [agent.o] Error 1

Maybe wrong default compiler / missing dependency?

Install errors with TextWorld 1.10

I ran into another build issue installing TextWorld 1.10 (the version pushed to PyPI earlier today).

To replicate in a clean Conda environment on macOS:

brew install libffi curl git
conda create --name textworld python=3.7
conda activate textworld
pip install textworld

This fails with the following error:

$ pip install textworld
Collecting textworld
  Using cached https://files.pythonhosted.org/packages/57/db/d819321f11211f3ecdfd618031260e0d5bc474eb0d4c49127f042dfad0c2/textworld-1.1.0.tar.gz
Collecting numpy>=1.13.1 (from textworld)
  Using cached https://files.pythonhosted.org/packages/46/e4/4a0cc770e4bfb34b4e10843805fef67b9a94027e59162a586c776f35c5bb/numpy-1.16.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting tqdm>=4.17.1 (from textworld)
  Using cached https://files.pythonhosted.org/packages/76/4c/103a4d3415dafc1ddfe6a6624333971756e2d3dd8c6dc0f520152855f040/tqdm-4.30.0-py2.py3-none-any.whl
Collecting cffi>=1.0.0 (from textworld)
  Using cached https://files.pythonhosted.org/packages/0b/ba/32835c9965d8a0090723e1d0b47373365525c4bd08c807b5efdc9fecbc99/cffi-1.11.5-cp37-cp37m-macosx_10_9_x86_64.whl
Collecting networkx>=2 (from textworld)
Collecting pyyaml>=3.12 (from textworld)
Collecting urwid>=2.0.1 (from textworld)
Collecting more_itertools (from textworld)
  Using cached https://files.pythonhosted.org/packages/a4/a6/42f17d065bda1fac255db13afc94c93dbfb64393eae37c749b4cb0752fc7/more_itertools-5.0.0-py3-none-any.whl
Collecting tatsu>=4.3.0 (from textworld)
  Using cached https://files.pythonhosted.org/packages/4a/2a/73ab41b283bdad217bbcd58751662d7edcb650c3dc810c8caa58f2fdcf49/TatSu-4.3.0-py2.py3-none-any.whl
Collecting hashids>=1.2.0 (from textworld)
Collecting jericho>=1.1.5 (from textworld)
Collecting pybars3>=0.9.3 (from textworld)
Collecting flask>=1.0.2 (from textworld)
  Using cached https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl
Collecting selenium>=3.12.0 (from textworld)
  Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Collecting greenlet==0.4.13 (from textworld)
Collecting gevent==1.3.5 (from textworld)
Collecting pillow>=5.1.0 (from textworld)
  Using cached https://files.pythonhosted.org/packages/c9/ed/27cc92e99b9ccaa0985a66133baeea7e8a3371d3c04cfa353aaa3b81aac1/Pillow-5.4.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting pydot>=1.2.4 (from textworld)
  Using cached https://files.pythonhosted.org/packages/33/d1/b1479a770f66d962f545c2101630ce1d5592d90cb4f083d38862e93d16d2/pydot-1.4.1-py2.py3-none-any.whl
Collecting prompt_toolkit<2.1.0,>=2.0.0 (from textworld)
  Using cached https://files.pythonhosted.org/packages/65/c2/e676da701cda11b32ff42eceb44aa7d8934b597d604bb5e94c0283def064/prompt_toolkit-2.0.8-py3-none-any.whl
Collecting gym==0.10.4 (from textworld)
Collecting pycparser (from cffi>=1.0.0->textworld)
Collecting decorator>=4.3.0 (from networkx>=2->textworld)
  Using cached https://files.pythonhosted.org/packages/f1/cd/7c8240007e9716b14679bc217a1baefa4432aa30394f7e2ec40a52b1a708/decorator-4.3.2-py2.py3-none-any.whl
Collecting six<2.0.0,>=1.0.0 (from more_itertools->textworld)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting PyMeta3>=0.5.1 (from pybars3>=0.9.3->textworld)
Collecting Werkzeug>=0.14 (from flask>=1.0.2->textworld)
  Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl
Collecting itsdangerous>=0.24 (from flask>=1.0.2->textworld)
  Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask>=1.0.2->textworld)
  Using cached https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl
Collecting click>=5.1 (from flask>=1.0.2->textworld)
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting urllib3 (from selenium>=3.12.0->textworld)
  Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
Collecting pyparsing>=2.1.4 (from pydot>=1.2.4->textworld)
  Using cached https://files.pythonhosted.org/packages/de/0a/001be530836743d8be6c2d85069f46fecf84ac6c18c7f5fb8125ee11d854/pyparsing-2.3.1-py2.py3-none-any.whl
Collecting wcwidth (from prompt_toolkit<2.1.0,>=2.0.0->textworld)
  Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Collecting requests>=2.0 (from gym==0.10.4->textworld)
  Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
Collecting pyglet>=1.2.0 (from gym==0.10.4->textworld)
  Using cached https://files.pythonhosted.org/packages/1c/fc/dad5eaaab68f0c21e2f906a94ddb98175662cc5a654eee404d59554ce0fa/pyglet-1.3.2-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask>=1.0.2->textworld)
  Using cached https://files.pythonhosted.org/packages/96/52/eef455862764cb6d6c136aa52c7f9fc4e7c1c644790a7107b1244a2b8a53/MarkupSafe-1.1.0-cp37-cp37m-macosx_10_6_intel.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.0->gym==0.10.4->textworld)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests>=2.0->gym==0.10.4->textworld)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Requirement already satisfied: certifi>=2017.4.17 in /Users/leon/miniconda3/envs/textworld/lib/python3.7/site-packages (from requests>=2.0->gym==0.10.4->textworld) (2018.11.29)
Collecting future (from pyglet>=1.2.0->gym==0.10.4->textworld)
Building wheels for collected packages: textworld
  Building wheel for textworld (setup.py) ... error
  Complete output from command /Users/leon/miniconda3/envs/textworld/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-wheel-c2qxr8sz --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  + echo 'Running setup.sh...'
  Running setup.sh...
  ++ uname -s
  + unameOut=Darwin
  + case "${unameOut}" in
  + machine=Mac
  + cd textworld/thirdparty/
  + '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
  + echo 'Downloading Inform7 CLI'
  Downloading Inform7 CLI
  + curl -LO http://inform7.com/download/content/6M62/I7_6M62_Linux_all.tar.gz
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100 22.1M  100 22.1M    0     0  8956k      0  0:00:02  0:00:02 --:--:-- 8956k
  + '[' Mac == Mac ']'
  + '[' '!' -e I7-6M62-OSX.dmg ']'
  + echo 'Downloading Inform7 for Mac'
  Downloading Inform7 for Mac
  + curl -LO http://inform7.com/download/content/6M62/I7-6M62-OSX.dmg
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100 27.4M  100 27.4M    0     0  8716k      0  0:00:03  0:00:03 --:--:-- 8718k
  + '[' '!' -d inform7-6M62 ']'
  + echo 'Installing Inform7 CLI'
  Installing Inform7 CLI
  + cd inform7-6M62/
  + ./install-inform7.sh --prefix /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62
  + cd ..
  + rm -f inform7-6M62/share/inform7/Internal/I6T/Actions.i6t
  + cp inform7/share/inform7/Internal/I6T/Actions.i6t inform7-6M62/share/inform7/Internal/I6T/Actions.i6t
  + '[' Mac == Mac ']'
  + '[' -e inform7-6M62 ']'
  + echo 'Mounting Inform for Mac'
  Mounting Inform for Mac
  + hdiutil attach ./I7-6M62-OSX.dmg
  Checksumming Protective Master Boot Record (MBR : 0)…
  Protective Master Boot Record (MBR :: verified CRC32 $252B40D3
  Checksumming GPT Header (Primary GPT Header : 1)…
   GPT Header (Primary GPT Header : 1): verified CRC32 $677934B8
  Checksumming GPT Partition Data (Primary GPT Table : 2)…
  GPT Partition Data (Primary GPT Tabl: verified CRC32 $116B510C
  Checksumming  (Apple_Free : 3)…
                      (Apple_Free : 3): verified CRC32 $00000000
  Checksumming disk image (Apple_HFS : 4)…
            disk image (Apple_HFS : 4): verified CRC32 $057BB535
  Checksumming  (Apple_Free : 5)…
                      (Apple_Free : 5): verified CRC32 $00000000
  Checksumming GPT Partition Data (Backup GPT Table : 6)…
  GPT Partition Data (Backup GPT Table: verified CRC32 $116B510C
  Checksumming GPT Header (Backup GPT Header : 7)…
    GPT Header (Backup GPT Header : 7): verified CRC32 $676DD2DA
  verified CRC32 $6521C609
  /dev/disk2            GUID_partition_scheme
  /dev/disk2s1          Apple_HFS                       /Volumes/Inform
  + echo 'Copying Mac compiled inform files'
  Copying Mac compiled inform files
  ++ pwd
  + current_dir=/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty
  + cd /Volumes/Inform/Inform.app/Contents/MacOS
  + cp cBlorb inform6 Inform intest ni /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62/share/inform7/Compilers/
  + cp ./git /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62/share/inform7/Interpreters/dumb-git
  + cp ./glulxe /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62/share/inform7/Interpreters/dumb-glulxe
  + cd /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty
  + echo 'Unmounting Inform for Mac'
  Unmounting Inform for Mac
  + hdiutil detach /Volumes/Inform/
  "disk2" ejected.
  + '[' '!' -d frotz ']'
  + cd frotz/
  + make -B dumb
  gcc -O2  -o src/common/buffer.o -c src/common/buffer.c
  gcc -O2  -o src/common/err.o -c src/common/err.c
  gcc -O2  -o src/common/fastmem.o -c src/common/fastmem.c
  gcc -O2  -o src/common/files.o -c src/common/files.c
  gcc -O2  -o src/common/hotkey.o -c src/common/hotkey.c
  gcc -O2  -o src/common/input.o -c src/common/input.c
  gcc -O2  -o src/common/main.o -c src/common/main.c
  gcc -O2  -o src/common/math.o -c src/common/math.c
  gcc -O2  -o src/common/object.o -c src/common/object.c
  gcc -O2  -o src/common/process.o -c src/common/process.c
  gcc -O2  -o src/common/quetzal.o -c src/common/quetzal.c
  gcc -O2  -o src/common/random.o -c src/common/random.c
  gcc -O2  -o src/common/redirect.o -c src/common/redirect.c
  gcc -O2  -o src/common/screen.o -c src/common/screen.c
  gcc -O2  -o src/common/sound.o -c src/common/sound.c
  gcc -O2  -o src/common/stream.o -c src/common/stream.c
  gcc -O2  -o src/common/table.o -c src/common/table.c
  gcc -O2  -o src/common/text.o -c src/common/text.c
  gcc -O2  -o src/common/variable.o -c src/common/variable.c

  Archiving common code...
  /usr/bin/ar rc src/frotz_common.a src/common/buffer.o src/common/err.o src/common/fastmem.o src/common/files.o src/common/hotkey.o src/common/input.o src/common/main.o src/common/math.o src/common/object.o src/common/process.o src/common/quetzal.o src/common/random.o src/common/redirect.o src/common/screen.o src/common/sound.o src/common/stream.o src/common/table.o src/common/text.o src/common/variable.o
  /usr/bin/ranlib src/frotz_common.a

  gcc -O2 -o src/dumb/dumb_init.o -c src/dumb/dumb_init.c
  gcc -O2 -o src/dumb/dumb_input.o -c src/dumb/dumb_input.c
  src/dumb/dumb_input.c:129:39: warning: implicit conversion from 'int' to 'char' changes value from 142 to -114 [-Wconstant-conversion]
        case '0': *dest++ = ZC_FKEY_MIN + 9; break;
                          ~ ~~~~~~~~~~~~^~~
  src/dumb/dumb_input.c:252:32: warning: passing 'zchar *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
          dumb_discard_old_input(strlen(continued_line_chars));
                                        ^~~~~~~~~~~~~~~~~~~~
  /usr/include/string.h:82:28: note: passing argument to parameter '__s' here
  size_t   strlen(const char *__s);
                              ^
  src/dumb/dumb_input.c:267:14: warning: field precision should have type 'int', but argument has type 'long' [-Wformat]
            printf("%.*s", next_page - current_page, current_page);
                    ~~^~   ~~~~~~~~~~~~~~~~~~~~~~~~
  src/dumb/dumb_input.c:375:10: warning: passing 'zchar *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
    strcat(buf, read_line_buffer);
           ^~~
  /usr/include/secure/_string.h:131:27: note: expanded from macro 'strcat'
                  __builtin___strcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                          ^~~~
  4 warnings generated.
  gcc -O2 -o src/dumb/dumb_output.o -c src/dumb/dumb_output.c
  gcc -O2 -o src/dumb/dumb_pic.o -c src/dumb/dumb_pic.c

  Archiving dumb interface code...
  /usr/bin/ar rc src/frotz_dumb.a src/dumb/dumb_init.o src/dumb/dumb_input.o src/dumb/dumb_output.o src/dumb/dumb_pic.o
  /usr/bin/ranlib src/frotz_dumb.a

  gcc -o dfrotz src/frotz_common.a src/frotz_dumb.a
  ld: warning: ignoring file src/frotz_dumb.a, file was built for archive which is not the architecture being linked (x86_64): src/frotz_dumb.a
  ld: warning: ignoring file src/frotz_common.a, file was built for archive which is not the architecture being linked (x86_64): src/frotz_common.a
  Undefined symbols for architecture x86_64:
    "_main", referenced from:
       implicit entry/start for main executable
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [frotz-dumb] Error 1
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py", line 67, in <module>
      'nose==1.3.7',
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 188, in run
      self.run_command('build')
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py", line 37, in run
      _pre_install(None)
    File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py", line 18, in _pre_install
      check_call(['./setup.sh'], shell=True, cwd=os.getcwd())
    File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['./setup.sh']' returned non-zero exit status 2.

  ----------------------------------------
  Failed building wheel for textworld
  Running setup.py clean for textworld
Failed to build textworld
Installing collected packages: numpy, tqdm, pycparser, cffi, decorator, networkx, pyyaml, urwid, six, more-itertools, tatsu, hashids, jericho, PyMeta3, pybars3, Werkzeug, itsdangerous, MarkupSafe,Jinja2, click, flask, urllib3, selenium, greenlet, gevent, pillow, pyparsing, pydot, wcwidth, prompt-toolkit, chardet, idna, requests, future, pyglet, gym, textworld
  Running setup.py install for textworld ... error
    Complete output from command /Users/leon/miniconda3/envs/textworld/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-record-5kd705kj/install-record.txt --single-version-externally-managed --compile:
    running install
    Running post install task
    + echo 'Running setup.sh...'
    Running setup.sh...
    ++ uname -s
    + unameOut=Darwin
    + case "${unameOut}" in
    + machine=Mac
    + cd textworld/thirdparty/
    + '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
    + '[' '!' -d inform7-6M62 ']'
    + echo 'Installing Inform7 CLI'
    Installing Inform7 CLI
    + cd inform7-6M62/
    + ./install-inform7.sh --prefix /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62
    + cd ..
    + rm -f inform7-6M62/share/inform7/Internal/I6T/Actions.i6t
    + cp inform7/share/inform7/Internal/I6T/Actions.i6t inform7-6M62/share/inform7/Internal/I6T/Actions.i6t
    + '[' Mac == Mac ']'
    + '[' -e inform7-6M62 ']'
    + echo 'Mounting Inform for Mac'
    Mounting Inform for Mac
    + hdiutil attach ./I7-6M62-OSX.dmg
    expected CRC32 $6521C609
    /dev/disk2                  GUID_partition_scheme
    /dev/disk2s1                Apple_HFS                       /Volumes/Inform
    + echo 'Copying Mac compiled inform files'
    Copying Mac compiled inform files
    ++ pwd
    + current_dir=/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty
    + cd /Volumes/Inform/Inform.app/Contents/MacOS
    + cp cBlorb inform6 Inform intest ni /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62/share/inform7/Compilers/
    + cp ./git /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62/share/inform7/Interpreters/dumb-git
    + cp ./glulxe /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty/inform7-6M62/share/inform7/Interpreters/dumb-glulxe
    + cd /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/textworld/thirdparty
    + echo 'Unmounting Inform for Mac'
    Unmounting Inform for Mac
    + hdiutil detach /Volumes/Inform/
    "disk2" ejected.
    + '[' '!' -d frotz ']'
    + cd frotz/
    + make -B dumb
    gcc -O2  -o src/common/buffer.o -c src/common/buffer.c
    gcc -O2  -o src/common/err.o -c src/common/err.c
    gcc -O2  -o src/common/fastmem.o -c src/common/fastmem.c
    gcc -O2  -o src/common/files.o -c src/common/files.c
    gcc -O2  -o src/common/hotkey.o -c src/common/hotkey.c
    gcc -O2  -o src/common/input.o -c src/common/input.c
    gcc -O2  -o src/common/main.o -c src/common/main.c
    gcc -O2  -o src/common/math.o -c src/common/math.c
    gcc -O2  -o src/common/object.o -c src/common/object.c
    gcc -O2  -o src/common/process.o -c src/common/process.c
    gcc -O2  -o src/common/quetzal.o -c src/common/quetzal.c
    gcc -O2  -o src/common/random.o -c src/common/random.c
    gcc -O2  -o src/common/redirect.o -c src/common/redirect.c
    gcc -O2  -o src/common/screen.o -c src/common/screen.c
    gcc -O2  -o src/common/sound.o -c src/common/sound.c
    gcc -O2  -o src/common/stream.o -c src/common/stream.c
    gcc -O2  -o src/common/table.o -c src/common/table.c
    gcc -O2  -o src/common/text.o -c src/common/text.c
    gcc -O2  -o src/common/variable.o -c src/common/variable.c

    Archiving common code...
    /usr/bin/ar rc src/frotz_common.a src/common/buffer.o src/common/err.o src/common/fastmem.o src/common/files.o src/common/hotkey.o src/common/input.o src/common/main.o src/common/math.o src/common/object.o src/common/process.o src/common/quetzal.o src/common/random.o src/common/redirect.o src/common/screen.o src/common/sound.o src/common/stream.o src/common/table.o src/common/text.o src/common/variable.o
    /usr/bin/ranlib src/frotz_common.a

    gcc -O2 -o src/dumb/dumb_init.o -c src/dumb/dumb_init.c
    gcc -O2 -o src/dumb/dumb_input.o -c src/dumb/dumb_input.c
    src/dumb/dumb_input.c:129:39: warning: implicit conversion from 'int' to 'char' changes value from 142 to -114 [-Wconstant-conversion]
          case '0': *dest++ = ZC_FKEY_MIN + 9; break;
                            ~ ~~~~~~~~~~~~^~~
    src/dumb/dumb_input.c:252:32: warning: passing 'zchar *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
            dumb_discard_old_input(strlen(continued_line_chars));
                                          ^~~~~~~~~~~~~~~~~~~~
    /usr/include/string.h:82:28: note: passing argument to parameter '__s' here
    size_t   strlen(const char *__s);
                                ^
    src/dumb/dumb_input.c:267:14: warning: field precision should have type 'int', but argument has type 'long' [-Wformat]
              printf("%.*s", next_page - current_page, current_page);
                      ~~^~   ~~~~~~~~~~~~~~~~~~~~~~~~
    src/dumb/dumb_input.c:375:10: warning: passing 'zchar *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
      strcat(buf, read_line_buffer);
             ^~~
    /usr/include/secure/_string.h:131:27: note: expanded from macro 'strcat'
                    __builtin___strcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                            ^~~~
    4 warnings generated.
    gcc -O2 -o src/dumb/dumb_output.o -c src/dumb/dumb_output.c
    gcc -O2 -o src/dumb/dumb_pic.o -c src/dumb/dumb_pic.c

    Archiving dumb interface code...
    /usr/bin/ar rc src/frotz_dumb.a src/dumb/dumb_init.o src/dumb/dumb_input.o src/dumb/dumb_output.o src/dumb/dumb_pic.o
    /usr/bin/ranlib src/frotz_dumb.a

    gcc -o dfrotz src/frotz_common.a src/frotz_dumb.a
    ld: warning: ld: warning: ignoring file src/frotz_common.a, file was built for archive which is not the architecture being linked (x86_64): src/frotz_common.a
    ignoring file src/frotz_dumb.a, file was built for archive which is not the architecture being linked (x86_64): src/frotz_dumb.a
    Undefined symbols for architecture x86_64:
      "_main", referenced from:
         implicit entry/start for main executable
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [frotz-dumb] Error 1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py", line 67, in <module>
        'nose==1.3.7',
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py", line 24, in run
        msg="Running post install task")
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 335, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/distutils/util.py", line 286, in execute
        func(*args)
      File "/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py", line 18, in _pre_install
        check_call(['./setup.sh'], shell=True, cwd=os.getcwd())
      File "/Users/leon/miniconda3/envs/textworld/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['./setup.sh']' returned non-zero exit status 2.

    ----------------------------------------
Command "/Users/leon/miniconda3/envs/textworld/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-record-5kd705kj/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/8r/mj5p4vvj4wj1dbl7bz7gj1hc0000gn/T/pip-install-yfs_da44/textworld/

Looks like this is a different error from #121.

Using `intermediate_reward` causes randomly `done=True`

When we switch on the intermediate_reward for the environments made via tw-custom, there's some bug which causes the env to finish the epiode(done=True) and give info["has_lost"]=True whenever the agent eats anything (for eg eat pizza). This does not happen when we're not using intermediate_reward.

Also, in the sample notebook provided, there the reward = score - self.last_score # Reward is the gain/loss in score. Is there any theory/evidence as for why this helps or is done? I'd greatly appreciate that as well.

Can we obtain the game map in a data format?

Hi, I've found out the --overview and --save-overview option which can generate an image representation of the generated game map with the locations and the inventory/objective. Is there a way to obtain the generated game graph/map? Which contains the different rooms and the connection label between the rooms? For example, Kitchen and a connection west to room..etc. in a text/JSON/graph format etc.. something other than an image..

Or maybe there is someplace in the repo. from where I can obtain this information?
Thanks.

Issues with generating `treasure hunter` challenges

I am able to generate treasure hunter challenge maps using tw-make tw-treasure_hunter --level x, however when I try and use higher levels the map generation frequently (but not always) produces the following error:

Traceback (most recent call last):
  File "/home/ben/miniconda3/envs/pytorch10/bin/tw-make", line 191, in <module>
    game = make_game(settings=args.__dict__, options=options)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/challenges/treasure_hunter.py", line 108, in make
    return make_game(mode, options)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/challenges/treasure_hunter.py", line 211, in make_game
    world.state = chain.initial_state
AttributeError: 'NoneType' object has no attribute 'initial_state'

I can get the above error with with levels 7 onwards - tw-make tw-treasure_hunter --level 7 --seed 5 produces an error, but seeds 1-4 do not.

From experimenting with a few seeds, the success rate seems to drop rapidly as the levels increase and I was not able to generate a single level 20 map, however levels 21 onward seem to generate completely fine all of the time.

Multiple inheritance issue?

Hi,
I tried adding the box kind (of kinds o and c) based on the example you supplied. However, it seems to be creating problems when building the logic rules (I think with the room, since it's both an object and container):

Traceback (most recent call last):

  File "<ipython-input-2-2cd076114184>", line 1, in <module>
    runfile('/home/rlvn-25/dev/ext/TextWorld/notebooks/make_example_game.py', wdir='/home/rlvn-25/dev/ext/TextWorld/notebooks')

  File "/home/rlvn-25/anaconda3/envs/textworld/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 678, in runfile
    execfile(filename, namespace)

  File "/home/rlvn-25/anaconda3/envs/textworld/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 106, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/rlvn-25/dev/ext/TextWorld/notebooks/make_example_game.py", line 7, in <module>
    import textworld

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/__init__.py", line 14, in <module>
    from textworld.generator import Game, GameMaker

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/generator/__init__.py", line 249, in <module>
    load_data()

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/generator/data/__init__.py", line 180, in load_data
    load_logic(pjoin(target_dir, "logic"))

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/generator/data/__init__.py", line 134, in load_logic
    logic = GameLogic.load(paths)

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/logic/__init__.py", line 1415, in load
    result._initialize()

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/logic/__init__.py", line 1349, in _initialize
    self.inform7._initialize(self)

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/logic/__init__.py", line 1263, in _initialize
    self._expand_predicates(logic)

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/logic/__init__.py", line 1273, in _expand_predicates
    self._add_predicate(Inform7Predicate(expanded, pred.source))

  File "/home/rlvn-25/dev/ext/TextWorld/textworld/logic/__init__.py", line 1250, in _add_predicate
    raise ValueError("Duplicate Inform 7 predicate for {}".format(sig))

ValueError: Duplicate Inform 7 predicate for at(box, r)

Issue with generating `coin collector` challenges

I am able to generate coin collector challenge maps using levels 0 to 99 (using tw-make tw-coin_collector --level x however when I try and use level 100 or higher there are two different error messages that appear. These will not appear all of the time (due to the random seed), but will appear quite frequently.

The first (which can be replicated with tw-make tw-coin_collector --level 100 --seed 1) is:

Traceback (most recent call last):
  File "/home/ben/miniconda3/envs/pytorch10/bin/tw-make", line 191, in <module>
    game = make_game(settings=args.__dict__, options=options)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/challenges/coin_collector.py", line 75, in make
    return make_game(distractor_mode, options)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/challenges/coin_collector.py", line 98, in make_game
    if mode == "simple" and float(options.nb_rooms) / options.quest_length > 4:
ZeroDivisionError: float division by zero

The second (which seems to only appear when level > 200, can be replicated with tw-make tw-coin_collector --level 250 --seed 1) is:

Traceback (most recent call last):
  File "/home/ben/miniconda3/envs/pytorch10/bin/tw-make", line 191, in <module>
    game = make_game(settings=args.__dict__, options=options)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/challenges/coin_collector.py", line 75, in make
    return make_game(distractor_mode, options)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/challenges/coin_collector.py", line 160, in make_game
    M.set_quest_from_commands(walkthrough)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/maker.py", line 569, in set_quest_from_commands
    game_file = self.compile(pjoin(tmpdir, "record_quest.ulx"))
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/maker.py", line 713, in compile
    self._working_game = self.build()
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/maker.py", line 693, in build
    game.change_grammar(self.grammar)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/game.py", line 398, in change_grammar
    generate_text_from_grammar(self, self.grammar)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/text_generation.py", line 112, in generate_text_from_grammar
    assign_name_to_object(room, grammar, game.infos)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/text_generation.py", line 82, in assign_name_to_object
    values = grammar.generate_name(obj.type, room_type=obj_infos.room_type, exclude=exclude)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/text_grammar.py", line 348, in generate_name
    name, adj, noun = self.generate_name(obj_type, room_type, include_adj=True, exclude=exclude)
  File "/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/text_grammar.py", line 365, in generate_name
    raise ValueError(msg)
ValueError: Not enough variation for '#work_(r)#'. You can add more variation in the 'house' related grammar files located in '/home/ben/miniconda3/envs/pytorch10/lib/python3.7/site-packages/textworld/generator/data/text_grammars' or turn on the 'include_adj=True' grammar flag. In last resort, you could always turn on the 'allowed_variables_numbering=True' grammar flag to append unique number to object name.

Problems running the notebooks

Hi,
Exciting work with the TextWorld environment.
I was trying to run your notebooks at https://github.com/Microsoft/TextWorld/blob/master/notebooks/
but they weren't working for me properly (Ubuntu 18.04, Anaconda 5.2 with Python 3.7).

  1. M.render() wasn't working:
    To fix it, I had to:
  • Install a few extra packages which weren't in the requirements file: selenium, pybars3, flask, Pillow, gevent
  • Add to the render/__init__.py file: from textworld.render.serve import get_html_template (just a quick hack, there's probably a better way to get the imports working properly)
  • Add the chromedriver executable from http://chromedriver.chromium.org/getting-started to the PATH
  1. notebooks/make_example_game.py wasn't working either, to fix it I added to the envs/__init__.py file: from textworld.envs.wrappers import * (again, maybe there's a better way)

Possibly missing Zork1 solution file

In test_zork1.py there is the following line:
walkthrough_file = os.path.abspath(pjoin(env.game_filename, "..", "solutions", "zork1.txt"))

I was unable to find this solution file and the zork1_walkthrough.txt does not solve the game successfully.

Thanks,
Chen

pybars dependency

I consistently find this issue on python3.6 on both osx and linux when trying to use tw-make:

mohanty@cluster9654:/tmp$ tw-make custom --world-size 5 --nb-objects 10 --quest-length 5 --output gen_games/
Traceback (most recent call last):
  File "/home/mohanty/anaconda3/bin/tw-make", line 10, in <module>
    import textworld
  File "/home/mohanty/anaconda3/lib/python3.6/site-packages/textworld/__init__.py", line 9, in <module>
    from textworld.generator import Game, GameMaker
  File "/home/mohanty/anaconda3/lib/python3.6/site-packages/textworld/generator/__init__.py", line 26, in <module>
    from textworld.generator.maker import GameMaker
  File "/home/mohanty/anaconda3/lib/python3.6/site-packages/textworld/generator/maker.py", line 24, in <module>
    from textworld.render import visualize
  File "/home/mohanty/anaconda3/lib/python3.6/site-packages/textworld/render/__init__.py", line 6, in <module>
    from textworld.render.serve import get_html_template
  File "/home/mohanty/anaconda3/lib/python3.6/site-packages/textworld/render/serve.py", line 23, in <module>
    import pybars
ModuleNotFoundError: No module named 'pybars'
mohanty@cluster9654:/tmp$ pip install pybars
Collecting pybars
  Downloading https://files.pythonhosted.org/packages/67/84/e61926cdb9f17576e69a7cf5a505be7dcf479765a821d95449f5d1f4b08a/pybars-0.0.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ql1njnsw/pybars/setup.py", line 22, in <module>
        description = file(
    NameError: name 'file' is not defined

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ql1njnsw/pybars/
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
mohanty@cluster9654:/tmp$

Errors during installation

I followed the readme instructions to install TextWorld. When I execute the command on my Ubuntu 18.04 box with Python3 3.6.7 installed and PIP installed too:

pip install .

I get the error output below. How do I fix this?

  Running setup.py install for textworld ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-cNatrJ-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-8h1DWH-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    Running post install task
    + echo 'Running setup.sh...'
    Running setup.sh...
    ++ uname -s
    + unameOut=Linux
    + case "${unameOut}" in
    + machine=Linux
    + tatsu textworld/logic/logic.ebnf -o textworld/logic/parser.py -G textworld/logic/model.py
    ./setup.sh: line 19: tatsu: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-cNatrJ-build/setup.py", line 67, in <module>
        'nose==1.3.7',
      File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-cNatrJ-build/setup.py", line 24, in run
        msg="Running post install task")
      File "/usr/lib/python2.7/distutils/cmd.py", line 349, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "/usr/lib/python2.7/distutils/util.py", line 309, in execute
        func(*args)
      File "/tmp/pip-cNatrJ-build/setup.py", line 18, in _pre_install
        check_call(['./setup.sh'], shell=True, cwd=os.getcwd())
      File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['./setup.sh']' returned non-zero exit status 127
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-cNatrJ-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-8h1DWH-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-cNatrJ-build/

Problem on running play_generated_games.py script

Hi,

I use the current master's play_generated_games.py script and it fails as follows,

(textworld)  % python play_generated_games.py                                                                                                            ilkerkesen/ajan-metin (master ⚡) raftel
Random seed: 38653
Traceback (most recent call last):
  File "play_generated_games.py", line 135, in <module>
    main()
  File "play_generated_games.py", line 99, in main
    seed=game_seed, games_dir=args.output)
  File "/home/ilker/.conda/envs/textworld/lib/python3.7/site-packages/textworld/helpers.py", line 140, in make
    game = make_game(world_size, nb_objects, quest_length, grammar_flags)
  File "/home/ilker/.conda/envs/textworld/lib/python3.7/site-packages/textworld/generator/__init__.py", line 175, in make_game
    world = make_world(world_size, nb_objects=0, rngs=rngs)
  File "/home/ilker/.conda/envs/textworld/lib/python3.7/site-packages/textworld/generator/__init__.py", line 91, in make_world
    map_ = make_map(n_rooms=world_size, rng=rngs['rng_map'])
  File "/home/ilker/.conda/envs/textworld/lib/python3.7/site-packages/textworld/generator/__init__.py", line 47, in make_map
    edge_size = int(np.ceil(np.sqrt(n_rooms + 1)))
TypeError: can only concatenate list (not "int") to list

Run z-machine games in parallel

Hi, is there any method to run multiple z-machine games (e.g. zork1.z5) in parallel.
For games generated by tw-make this can be done via textworld.gym.make_batch, but how can I achieve this on z-machine games?

Handling Parts

In addition to #31 , it would be great to have support for parts as well, for more complex assemblies of objects, such as machines with different parts (controls, compartments, etc).

Missing dependency: git

In the requirements list for the programs you need to have installed, git is missing. This might be not that obvious untill you try to put a docker container together to run this and fail on the very last part, where it tries to git clone frotz.

Just as an idea: how about you provide a docker-image already setup with the neccessary requirements such that users can immediately start it?

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

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

A Quick Tutorial on .twl and .twg files?

Would it be possible to get a quick tutorial on .twg and .twl files? Either in this issue, or preferably as an addition to the documentation? Some details that would be welcome are:

  1. The basic syntax
  2. A how-to for creating a new game domain and/or adding some simple objects and actions
  3. Commands that need to be run in order to (re)parse twg and twl files.

As a motivation for this issue: I have been evaluating the cooking domain in MarcCote/TextWorld:human_study and there appears to be a bug in that domain where prepare meal does not actually change the underlying game facts (and the last_action, etc. of the game state are evaluated to None) even though the meal ends up in the inventory and one can win the game. I can't figure out how to update the twl files in order to fix that problem. (I think meal.twl is the culprit, but running tw-make after updating the file does not seem to be changing anything)

Random and Neural Agent low results

Hi, when executing the Building a simple agent notebook on my local machine or on Google Colab, i get very different results. I do not understand why if I did not make any changes to the code. For instance, when playing with the Random Agent I get the following results:

rewardsDense_goalDetailed.ulx..........  	avg. steps:  50.0; avg. score:  2.6 / 11.
rewardsBalanced_goalDetailed.ulx..........  	avg. steps:  50.0; avg. score:  0.1 / 5.
rewardsSparse_goalDetailed.ulx..........  	avg. steps:  50.0; avg. score:  0.0 / 1.

However, the GitHub results are the following:

rewardsDense_goalDetailed.ulx..........  	avg. steps: 100.0; avg. score:  4.2 / 11.
rewardsBalanced_goalDetailed.ulx..........  	avg. steps: 100.0; avg. score:  0.7 / 5.
rewardsSparse_goalDetailed.ulx..........  	avg. steps: 100.0; avg. score:  0.0 / 1.

As you can see, my code does less steps(half of them) and the scores are quite much worse. The same thing happens with the Neural Agent, which, for example, when training it takes quite less than the one that is on GitHub results.

Any idea of why could this be happening?

Running notebooks in Colab and pip installation on Mac OS

I'm having issues with installing TextWorld in Colab and Mac OS (Mojave). By following the basic setup instructions, I have only managed to install it on a Linux machine.

The error in Colab when installing TextWorld with pip:

ERROR: stable-baselines 2.2.1 has requirement gym[atari,classic_control]>=0.10.9, but you'll have gym 0.10.4 which is incompatible.
ERROR: jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.10 which is incompatible.
ERROR: ipython 5.5.0 has requirement prompt-toolkit<2.0.0,>=1.0.4, but you'll have prompt-toolkit 2.0.10 which is incompatible.
ERROR: dopamine-rl 1.0.5 has requirement gym>=0.10.5, but you'll have gym 0.10.4 which is incompatible.

On Mac pip install textworld is still experiencing the issue #170. Cloning the source code and running pip install . works so the pip version of TextWorld might be broken on Mac.

Simple agent with TextWorld doesn't have any explanation

I believe the agent in the notebook doesn't have any description. Is it possible to include any other material to support the code ? I am not sure if a more simple agent would help to get started. I can try a simpler version if I manage to understand enough.

Treasure Hunter game objectives

I've created multiple games with the hardest level of treasure_hunter: tw-make challenge tw-treasure_hunter-level30, but couldn't come across an objective that involves finding keys and unlocking doors, as mentioned in the paper.

Some of the sample objectives that I came across:

It's time to explore the amazing world of TextWorld! Here is how to play! Your
first objective is to go to the south.And then,go to the east.Next,head
east.That done,try to go south.Then,go west.Okay, and then,go to the west.And
then,recover the mouse from the armchair inside the cubicle. Got that? Good!
Get ready to pick stuff up and put it in places, because you've just entered
TextWorld! First off, make an attempt to move north.After that,go east.And
then,travel south.And then,make an effort to move east.Then,go to the
east.Following that,make an attempt to go south.And then,make an attempt to take
a trip south.Once you manage that,take a trip south.And then,head west.Next,try
to take a trip west.Following that,go west.Then,attempt to go to the
north.Following that,take a trip west.Then,try to travel north.And then,try to
move east.Following that,venture east.With that accomplished,venture east.With
that done,recover the legume from the saucepan in the cookhouse. Alright,
thanks!
It's time to explore the amazing world of TextWorld! Your first objective is to
travel south.If you can succeed at that,attempt to take a trip south.Next,move
east.Then,try to move north.Then,attempt to venture north.Okay, and then,attempt
to go east.With that over with,venture south.And then,make an attempt to travel
south.And then,take a trip south.Once you get around to doing that,take the
spork from the plate within the cookhouse. Once that's all handled, you can
stop!

Is this an intended behaviour and I'm missing something?

prompt-toolkit version is pretty old and conflicts...

Hi, the required version of prompt_toolkit conflicts with Jupyter notebook current install version... is this resolveable? you have notebook examples in here. thanks.

jupyter-console 6.0.0 has requirement prompt_toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.
ipython 7.2.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.

Guide to source code?

Is there a document that gives a guide to the code? The src sub-directory is virtually empty so I'm assuming that actual code that does the heavy lifting is downloaded later? I'm referring to the code that does things like the actual RL agent training, or more interesting to an NLP programmer like me, the vocabulary+context based sentence generator. Those are some of the interesting TextWorld components I heard mentioned by David Tao in his YouTube video on TextWorld:

https://www.youtube.com/watch?v=KRXit7rx0N8

Also, is the RL training CUDA based? I have a Titan X card but it's from the first generation line so it's a bit slow and the drivers are finicky.

Gym versioning

When installing textworld via pip and importing using

import textworld

I yield the following error

---------------------------------------------------------------------------
ContextualVersionConflict                 Traceback (most recent call last)
<ipython-input-4-e2b31a6d3ce9> in <module>()
----> 1 import textworld

/usr/local/lib/python3.6/dist-packages/textworld/__init__.py in <module>()
      8 
      9 from textworld.core import Environment, GameState, Agent
---> 10 from textworld.generator import Game, GameMaker, GameOptions
     11 from textworld.envs.wrappers.filter import EnvInfos
     12 

/usr/local/lib/python3.6/dist-packages/textworld/generator/__init__.py in <module>()
     21 from textworld.generator.text_generation import generate_text_from_grammar
     22 
---> 23 from textworld.generator import inform7
     24 from textworld.generator.inform7 import generate_inform7_source, compile_inform7_game
     25 from textworld.generator.inform7 import CouldNotCompileGameError

/usr/local/lib/python3.6/dist-packages/textworld/generator/inform7/__init__.py in <module>()
      3 
      4 
----> 5 from textworld.generator.inform7.world2inform7 import Inform7Game
      6 from textworld.generator.inform7.world2inform7 import generate_inform7_source
      7 from textworld.generator.inform7.world2inform7 import compile_inform7_game

/usr/local/lib/python3.6/dist-packages/textworld/generator/inform7/world2inform7.py in <module>()
     23 
     24 
---> 25 I7_DEFAULT_PATH = resource_filename(Requirement.parse('textworld'), 'textworld/thirdparty/inform7-6M62')
     26 
     27 

/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in resource_filename(self, package_or_requirement, resource_name)
   1142     def resource_filename(self, package_or_requirement, resource_name):
   1143         """Return a true filesystem path for specified resource"""
-> 1144         return get_provider(package_or_requirement).get_resource_filename(
   1145             self, resource_name
   1146         )

/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in get_provider(moduleOrReq)
    355     """Return an IResourceProvider for the named module or requirement"""
    356     if isinstance(moduleOrReq, Requirement):
--> 357         return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    358     try:
    359         module = sys.modules[moduleOrReq]

/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in require(self, *requirements)
    898         included, even if they were already activated in this working set.
    899         """
--> 900         needed = self.resolve(parse_requirements(requirements))
    901 
    902         for dist in needed:

/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
    789                 # Oops, the "best" so far conflicts with a dependency
    790                 dependent_req = required_by[req]
--> 791                 raise VersionConflict(dist, req).with_context(dependent_req)
    792 
    793             # push the new requirements onto the stack

ContextualVersionConflict: (gym 0.10.11 (/usr/local/lib/python3.6/dist-packages), Requirement.parse('gym==0.10.4'), {'textworld'})

Notebook to reproduce: https://colab.research.google.com/drive/1bbJhR6Bo0x-Zqz5AZC9qP0RaFoIwDESM

Problem running the simple agent notebook

I received the following error while running the simple neural agent in the notebook:

Traceback (most recent call last):
  File "debug.py", line 71, in <module>
    train_agent(agent, "obj_10_qlen_3_room_2/*ulx")
  File "debug.py", line 50, in train_agent
    game_state, reward, done = env.step(command)
  File "/home/anaconda3/envs/textworld/lib/python3.6/site-packages/textworld/envs/glulx/git_glulx_ml.py", line 441, in step
    self.game_state = self.game_state.update(command, output)
  File "/home/anaconda3/envs/textworld/lib/python3.6/site-packages/textworld/envs/glulx/git_glulx_ml.py", line 216, in update
    game_state._game_progression.update(game_state._action)
  File "/home/anaconda3/envs/textworld/lib/python3.6/site-packages/textworld/generator/game.py", line 624, in update
    self.quest_progression.update(action, bypass=self.winning_policy[:i])
  File "/home/anaconda3/envs/textworld/lib/python3.6/site-packages/textworld/generator/game.py", line 529, in update
    self._pop_action_from_tree(action, self._tree)
  File "/home/anaconda3/envs/textworld/lib/python3.6/site-packages/textworld/generator/game.py", line 486, in _pop_action_from_tree
    tree.pop(action)
  File "/home/anaconda3/envs/textworld/lib/python3.6/site-packages/textworld/generator/dependency_tree.py", line 109, in pop
    raise ValueError("That element is not a leaf: {!r}.".format(value))
ValueError: That element is not a leaf: Action('take/c-P-r-c-k-I', (Proposition('at', (Variable('P', 'P'), Variable('r_1', 'r'))), Proposition('at', (Variable('c_0', 'c'), Variable('r_1', 'r'))), Proposition('open', (Variable('c_0', 'c'),)), Proposition('in', (Variable('k_0', 'k'), Variable('c_0', 'c')))), (Proposition('at', (Variable('P', 'P'), Variable('r_1', 'r'))), Proposition('at', (Variable('c_0', 'c'), Variable('r_1', 'r'))), Proposition('open', (Variable('c_0', 'c'),)), Proposition('in', (Variable('k_0', 'k'), Variable('I', 'I'))))).

Any ideas what is going on?

Installation error due missing third-party library

Hi, I have a macOS 10.13.6 and I run into an error during the README.md installation steps.

I tried the steps:

brew install libffi curl git
conda create --name textworld python=3.7
conda activate textworld
pip install textworld

After it failed, I tried the following (as suggested in one of the replies of issue #130):

pip install https://github.com/Microsoft/TextWorld/archive/master.zip

Which entailed to the same error message.
I also tried to install previous commits that I was able to install before and got the same message.

I show the error message at the end of this message, and highlight here the fragment that I believe to be causing this error:

...

    + cd textworld/thirdparty/
    + '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
    + '[' '!' -d inform7-6M62 ']'
    + tar xf I7_6M62_Linux_all.tar.gz
    tar: Unrecognized archive format
    tar: Error exit delayed from previous errors.
...

The part of the error message that I highlighted leads me to believe that the problem is that the setup.sh was not able to download the file I7_6M62_Linux_all.tar.gz. I checked the link ( http://inform7.com/download/content/6M62/I7_6M62_Linux_all.tar.gz ) and, indeed, the link is broken. I went to the repository page of inform7 (https://aur.archlinux.org/packages/inform7/ ) and the repository seems to be gone.

I also read some other installation issues, like #116 and none of the above seems to address this problem

Any thoughts on that issue?

Just in case I missed something, there it is the entire error message:

Building wheels for collected packages: textworld
  Building wheel for textworld (setup.py) ... error
  ERROR: Complete output from command /Users/brenow/miniconda3/envs/textworld/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-wheel-i8i4tolc --python-tag cp37:
  ERROR: running bdist_wheel
  running build
  running build_py
  + echo 'Running setup.sh...'
  Running setup.sh...
  ++ uname -s
  + unameOut=Darwin
  + case "${unameOut}" in
  + machine=Mac
  + cd textworld/thirdparty/
  + '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
  + echo 'Downloading Inform7 CLI'
  Downloading Inform7 CLI
  + curl -LO http://inform7.com/download/content/6M62/I7_6M62_Linux_all.tar.gz
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100   363  100   363    0     0   1143      0 --:--:-- --:--:-- --:--:--  1145
  + '[' Mac == Mac ']'
  + '[' '!' -e I7-6M62-OSX.dmg ']'
  + echo 'Downloading Inform7 for Mac'
  Downloading Inform7 for Mac
  + curl -LO http://inform7.com/download/content/6M62/I7-6M62-OSX.dmg
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100   354  100   354    0     0   1175      0 --:--:-- --:--:-- --:--:--  1172
  + '[' '!' -d inform7-6M62 ']'
  + tar xf I7_6M62_Linux_all.tar.gz
  tar: Unrecognized archive format
  tar: Error exit delayed from previous errors.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py", line 67, in <module>
      'nose==1.3.7',
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py", line 37, in run
      _pre_install(None)
    File "/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py", line 18, in _pre_install
      check_call(['./setup.sh'], shell=True, cwd=os.getcwd())
    File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['./setup.sh']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for textworld
  Running setup.py clean for textworld
Failed to build textworld
Installing collected packages: textworld
  Running setup.py install for textworld ... error
    ERROR: Complete output from command /Users/brenow/miniconda3/envs/textworld/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-record-z70svmvj/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    Running post install task
    + echo 'Running setup.sh...'
    Running setup.sh...
    ++ uname -s
    + unameOut=Darwin
    + case "${unameOut}" in
    + machine=Mac
    + cd textworld/thirdparty/
    + '[' '!' -e I7_6M62_Linux_all.tar.gz ']'
    + '[' '!' -d inform7-6M62 ']'
    + tar xf I7_6M62_Linux_all.tar.gz
    tar: Unrecognized archive format
    tar: Error exit delayed from previous errors.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py", line 67, in <module>
        'nose==1.3.7',
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py", line 24, in run
        msg="Running post install task")
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/cmd.py", line 335, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/distutils/util.py", line 291, in execute
        func(*args)
      File "/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py", line 18, in _pre_install
        check_call(['./setup.sh'], shell=True, cwd=os.getcwd())
      File "/Users/brenow/miniconda3/envs/textworld/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['./setup.sh']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command "/Users/brenow/miniconda3/envs/textworld/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-record-z70svmvj/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/vz/hyt4bd3s7fl16jf_8dqf_l6c0000gn/T/pip-install-_uhqip78/textworld/

Broken functions in text_utils

This commit last week, which removes the global constants to form a single knowledgebase, also removed a few function being used in other places.

For instance, I found that the extract_vocab function in text_utils.py requires data.get_data_path function from the textworld.generator.data module.

This obviously makes it fail the test_extract_vocab.py and possibly affect few other. This does affect the generation of challenges/treasure_hunter.py

I temporarily fixed it for my use case by assigning DATA_PATH = os.path.dirname(__file__) and using it instead of data.get_data_path() in the extract_vocab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.