Skip to content

Commit fd0d419

Browse files
authored
Merge pull request #267 from MarcCote/doc_tw_cooking
Add documentation for tw-cooking challenge.
2 parents 494bdd9 + 06f4717 commit fd0d419

File tree

8 files changed

+72
-50
lines changed

8 files changed

+72
-50
lines changed

docs/source/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ TextWorld is a text-based learning environment for Reinforcement Learning agent.
2222
tw-view
2323
tw-extract
2424

25+
.. toctree::
26+
:maxdepth: 1
27+
:caption: Challenges:
28+
29+
textworld.challenges.simple
30+
textworld.challenges.coin_collector
31+
textworld.challenges.cooking
32+
textworld.challenges.treasure_hunter
33+
2534
.. toctree::
2635
:maxdepth: 1
2736
:caption: Package:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. automodule:: textworld.challenges.coin_collector
2+
:members:
3+
:undoc-members:
4+
:show-inheritance:
5+
6+
Usage
7+
-----
8+
.. argparse::
9+
:ref: textworld.challenges.tw_coin_collector.coin_collector.build_argparser
10+
:prog: tw-make tw-coin_collector
11+
:markdownhelp:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. automodule:: textworld.challenges.cooking
2+
:members:
3+
:undoc-members:
4+
:show-inheritance:
5+
6+
Usage
7+
-----
8+
.. argparse::
9+
:ref: textworld.challenges.tw_cooking.cooking.build_argparser
10+
:prog: tw-make tw-cooking
11+
:markdownhelp:
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
textworld.challenges
22
====================
33

4-
.. automodule:: textworld.challenges
5-
:members:
6-
:undoc-members:
7-
:show-inheritance:
4+
.. toctree::
5+
:maxdepth: 1
86

9-
.. automodule:: textworld.challenges.coin_collector
10-
:members:
11-
:undoc-members:
12-
:show-inheritance:
13-
14-
.. automodule:: textworld.challenges.treasure_hunter
15-
:members:
16-
:undoc-members:
17-
:show-inheritance:
18-
19-
.. automodule:: textworld.challenges.simple
20-
:members:
21-
:undoc-members:
22-
:show-inheritance:
7+
textworld.challenges.simple
8+
textworld.challenges.coin_collector
9+
textworld.challenges.cooking
10+
textworld.challenges.treasure_hunter
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
.. automodule:: textworld.challenges.simple
4+
:members:
5+
:undoc-members:
6+
:show-inheritance:
7+
8+
Usage
9+
-----
10+
.. argparse::
11+
:ref: textworld.challenges.tw_simple.simple.build_argparser
12+
:prog: tw-make tw-simple
13+
:markdownhelp:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. automodule:: textworld.challenges.treasure_hunter
2+
:members:
3+
:undoc-members:
4+
:show-inheritance:
5+
6+
Usage
7+
-----
8+
.. argparse::
9+
:ref: textworld.challenges.tw_treasure_hunter.treasure_hunter.build_argparser
10+
:prog: tw-make tw-treasure_hunter
11+
:markdownhelp:

scripts/tw-make

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ if __name__ == "__main__":
150150
parser, custom_parser, challenge_parsers = build_parser(default_parser_only=False)
151151
args = parser.parse_args()
152152

153+
if args.subcommand is None:
154+
print("Need to specify which type of game to create (either 'custom' or a challenge).")
155+
exit_listing_challenges(args.subcommand)
156+
153157
if args.seed is None:
154158
args.seed = np.random.randint(65635)
155159

textworld/challenges/tw_cooking/cooking.py

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,6 @@
1414
eat it. To control the game's difficulty, one can specify the amount of skills
1515
that are involved to solve it (see skills section below).
1616
17-
Skills
18-
------
19-
The required skills are:
20-
21-
* recipe{1,2,3} : Number of ingredients in the recipe.
22-
23-
The optional skills that can be combined are:
24-
25-
* take{1,2,3} : Number of ingredients to fetch. It must be less
26-
or equal to the value of the `recipe` skill.
27-
* open : Whether containers/doors need to be opened.
28-
* cook : Whether some ingredients need to be cooked.
29-
* cut : Whether some ingredients need to be cut.
30-
* drop : Whether the player's inventory has limited capacity.
31-
* go{1,6,9,12} : Number of locations in the game.
32-
33-
34-
Splits
35-
------
36-
In addition to the skills, one can specify from which disjoint distribution
37-
the game should be generated from:
38-
39-
* train : game use for training agent;
40-
* valid : game may contain food items (adj-noun pairs) unseen within
41-
the train split. It can also contain unseen food preparation;
42-
* test : game may contain food items (adj-noun pairs) unseen within
43-
the train split. It can also contain unseen food preparation.
44-
4517
References
4618
----------
4719
.. [1] https://aka.ms/ftwp
@@ -1317,7 +1289,7 @@ def _place_one_distractor(candidates, ingredient):
13171289
def build_argparser(parser=None):
13181290
parser = parser or argparse.ArgumentParser()
13191291

1320-
group = parser.add_argument_group('First TextWorld Competition game settings')
1292+
group = parser.add_argument_group('The Cooking Game settings')
13211293
group.add_argument("--recipe", type=int, default=1, metavar="INT",
13221294
help="Number of ingredients in the recipe. Default: %(default)s")
13231295
group.add_argument("--take", type=int, default=0, metavar="INT",
@@ -1337,9 +1309,12 @@ def build_argparser(parser=None):
13371309
help="Random seed used for generating the recipe. Default: %(default)s")
13381310

13391311
group.add_argument("--split", choices=["train", "valid", "test"],
1340-
help="Control which foods can be used. Can either be"
1341-
" 'train', 'valid', or 'test'."
1342-
" Default: foods from all dataset splits can be used.")
1312+
help="Specify the game distribution to use. Food items (adj-noun pairs) are split in three subsets."
1313+
" Also, the way the training food items can be prepared is further divided in three subsets.\n\n"
1314+
"* train: training food and their corresponding training preparations\n"
1315+
"* valid: valid food + training food but with unseen valid preparations\n"
1316+
"* test: test food + training food but with unseen test preparations\n\n"
1317+
" Default: game is drawn from the joint distribution over train, valid, and test.")
13431318

13441319
return parser
13451320

0 commit comments

Comments
 (0)