Skip to content

Commit 9fb7444

Browse files
authored
Update links to Inform7-6M62 build. (#303)
* Update links to Inform7-6M62 build. * Bump version to 1.5.3 * Update requirements.txt * networkx.OrderedGraph is deprecated, using networkx.Graph instead. * TextWorld now requires Python 3.7+ * Use gym.spaces.Space instead of None as the default action_space and observation_space. * Fix Selenium version
1 parent 6817a81 commit 9fb7444

File tree

11 files changed

+22
-19
lines changed

11 files changed

+22
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A text-based game generator and extensible sandbox learning environment for trai
66

77
## Installation
88

9-
TextWorld requires __Python 3__ and only supports __Linux__ and __macOS__ systems at the moment. For __Windows__ users, docker can be used as a workaround (see Docker section below).
9+
TextWorld requires __Python 3.7+__ and only supports __Linux__ and __macOS__ systems at the moment. For __Windows__ users, docker can be used as a workaround (see Docker section below).
1010

1111
### Requirements
1212

requirements-full.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tqdm>=4.17.1
44
cffi>=1.0.0
55
networkx>=2
66
more_itertools
7-
tatsu>=4.3.0
7+
tatsu>=4.3.0,<5
88
hashids>=1.2.0
99
jericho>=2.2.0
1010
mementos>=1.3.1
@@ -18,7 +18,7 @@ gym>=0.10.11
1818
# For visualization
1919
pybars3>=0.9.3
2020
flask>=1.0.2
21-
selenium>=3.12.0
21+
selenium>=3.12.0,<4.3
2222
greenlet>=0.4.13
2323
gevent>=1.3.5
2424
pillow>=5.1.0

requirements-vis.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# For visualization
22
pybars3>=0.9.3
33
flask>=1.0.2
4-
selenium>=3.12.0
4+
selenium>=3.12.0,<4.3
55
greenlet>=0.4.13
66
gevent>=1.3.5
77
pillow>=5.1.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tqdm>=4.17.1
44
cffi>=1.0.0
55
networkx>=2
66
more_itertools
7-
tatsu>=4.3.0
7+
tatsu>=4.3.0,<5
88
hashids>=1.2.0
99
jericho>=3.0.3
1010
mementos>=1.3.1

setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ cd textworld/thirdparty/
2020
# Install command line Inform 7
2121
if [ ! -e I7_6M62_Linux_all.tar.gz ]; then
2222
echo "Downloading Inform7 CLI"
23-
curl -LO http://inform7.com/apps/6M62/I7_6M62_Linux_all.tar.gz
23+
curl -LO http://emshort.com/inform-app-archive/6M62/I7_6M62_Linux_all.tar.gz
2424
if [ "${machine}" == 'Mac' ] && [ ! -e I7-6M62-OSX-Interim.dmg ]; then
2525
echo "Downloading Inform7 for Mac"
26-
curl -LO http://inform7.com/apps/6M62/I7-6M62-OSX-Interim.dmg
26+
curl -LO http://emshort.com/inform-app-archive/6M62/I7-6M62-OSX-Interim.dmg
2727
fi
2828
fi
2929
if [ ! -d inform7-6M62 ]; then

textworld/challenges/tw_cooking/cooking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def __init__(self, neighbors, size=(5, 5), max_attempts=200, rng=None):
729729
self.max_attempts = max_attempts
730730
self.neighbors = neighbors
731731
self.rng = rng or np.random.RandomState(1234)
732-
self.grid = nx.grid_2d_graph(size[0], size[1], create_using=nx.OrderedGraph())
732+
self.grid = nx.grid_2d_graph(size[0], size[1], create_using=nx.Graph())
733733
self.nb_attempts = 0
734734

735735
def _walk(self, G, node, remaining):
@@ -773,7 +773,7 @@ def place_rooms(self, rooms):
773773
self.rng.shuffle(nodes)
774774

775775
for start in nodes:
776-
G = nx.OrderedGraph()
776+
G = nx.Graph()
777777
room = rooms[0][0]
778778
G.add_node(start, id="r_{}".format(len(G)), name=room, start=True)
779779

textworld/generator/graph_networks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def gen_layout(rng, n_nodes=5, h=10, w=10):
3737
Generate a map with n_nodes rooms by
3838
picking a subgraph from a h,w grid.
3939
'''
40-
G = nx.grid_2d_graph(h, w, create_using=nx.OrderedGraph())
41-
new_G = nx.OrderedGraph()
40+
G = nx.grid_2d_graph(h, w, create_using=nx.Graph())
41+
new_G = nx.Graph()
4242
pos = (rng.randint(0, h - 1),
4343
rng.randint(0, w - 1))
4444
visited = set()
@@ -155,7 +155,7 @@ def create_map(rng, n_nodes, h, w, possible_door_states=["open", "closed", "lock
155155
def create_small_map(rng, n_rooms, possible_door_states=["open", "closed", "locked"]):
156156
G = nx.grid_2d_graph(3, 3)
157157

158-
G = nx.OrderedGraph()
158+
G = nx.Graph()
159159
room0 = (0, 0)
160160
G.add_node(room0, name="r_0")
161161

textworld/gym/envs/textworld_batch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import numpy as np
1111
import gym
1212
from gym.utils import colorize
13+
from gym.spaces import Space
1314

1415
from textworld import EnvInfos
1516
from textworld.envs.wrappers import Filter, GenericEnvironment, Limit
@@ -86,8 +87,8 @@ def __init__(self,
8687
BatchEnvType = AsyncBatchEnv if self.batch_size > 1 and asynchronous else SyncBatchEnv
8788
self.batch_env = BatchEnvType(env_fns, auto_reset)
8889

89-
self.action_space = action_space
90-
self.observation_space = observation_space
90+
self.action_space = action_space or Space()
91+
self.observation_space = observation_space or Space()
9192

9293
def seed(self, seed: Optional[int] = None) -> List[int]:
9394
""" Set the seed for this environment's random generator(s).

textworld/textgen/parser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _symbol_(self): # noqa
8686

8787
@tatsumasu()
8888
def _literal_(self): # noqa
89-
self._pattern('(([^;|<>\\n\\[\\]()]|\\[[^\\[\\]]*\\]|\\([^()]*\\))+(?<!\\s))?')
89+
self._pattern('(([^;|<>\\n\\[\\]()]|\\[[^\\[\\]]*\\]|\\([^()]*\\))+(?<!\\s))')
9090

9191
@tatsumasu('Literal')
9292
def _literalAlternative_(self): # noqa
@@ -137,6 +137,8 @@ def _alternative_(self): # noqa
137137
self._match_()
138138
with self._option():
139139
self._entity_()
140+
with self._option():
141+
self._void()
140142
self._error('no available options')
141143

142144
@tatsumasu()

textworld/textgen/textgen.ebnf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
symbol = ?"[\w()/!<>-]+" ;
99
10-
literal = ?"(([^;|<>\n\[\]()]|\[[^\[\]]*\]|\([^()]*\))+(?<!\s))?" ;
10+
literal = ?"(([^;|<>\n\[\]()]|\[[^\[\]]*\]|\([^()]*\))+(?<!\s))" ;
1111
1212
literalAlternative::Literal = value:literal ;
1313
@@ -17,7 +17,7 @@ entity = adjectiveNoun | literalAlternative ;
1717
1818
match::Match = lhs:entity "<->" rhs:entity ;
1919
20-
alternative = match | entity;
20+
alternative = match | entity | ();
2121
2222
alternatives = ";".{alternative}+ ;
2323

0 commit comments

Comments
 (0)