textworld.challenges

Coin Collector

In this type of game, the world consists in a chain of quest_length rooms with potentially distractors rooms (i.e. leading to a dead end). The agent stats on one end and has to collect a “coin” object which is placed at the other end. There is no other objects present in the world other than the coin to collect.

textworld.challenges.coin_collector.build_argparser(parser=None)[source]
textworld.challenges.coin_collector.make(settings, options=None)[source]

Make a Coin Collector game of the desired difficulty settings.

Parameters:
  • settings (Mapping[str, str]) – Difficulty level (see notes). Expected pattern: level[1-300].
  • options (Optional[GameOptions]) – For customizing the game generation (see textworld.GameOptions for the list of available options).
Return type:

Game

Returns:

Generated game.

Notes

Difficulty levels are defined as follows:

  • Level 1 to 100: Nb. rooms = level, quest length = level
  • Level 101 to 200: Nb. rooms = 2 * (level % 100), quest length = level % 100, distractors rooms added along the chain.
  • Level 201 to 300: Nb. rooms = 3 * (level % 100), quest length = level % 100, distractors rooms randomly added along the chain.
textworld.challenges.coin_collector.make_game(mode, options)[source]

Make a Coin Collector game.

Parameters:
  • mode (str) –

    Mode for the game where

    • 'simple': the distractor rooms are only placed orthogonaly to the chain. This means moving off the optimal path leads immediately to a dead end.
    • 'random': the distractor rooms are randomly place along the chain. This means a player can wander for a while before reaching a dead end.
  • options (GameOptions) – For customizing the game generation (see textworld.GameOptions for the list of available options).
Return type:

Game

Returns:

Generated game.

Treasure Hunter

In this type of game, the agent spawns in a randomly generated maze and must find a specific object mentioned in the objective displayed when the game stats. This is a text version of the task proposed in [Parisotto2017].

References

[Parisotto2017]Emilio Parisotto and Ruslan Salakhutdinov. Neural map: Structured memory for deep reinforcement learning. arXiv:1702.08360, 2017.
textworld.challenges.treasure_hunter.build_argparser(parser=None)[source]
textworld.challenges.treasure_hunter.make(settings, options=None)[source]

Make a Treasure Hunter game of the desired difficulty settings.

Parameters:
  • settings (Mapping[str, str]) – Difficulty level (see notes). Expected pattern: level[1-30].
  • options (Optional[GameOptions]) – For customizing the game generation (see textworld.GameOptions for the list of available options).
Returns:

Generated game.

Return type:

game

Notes

Difficulty levels are defined as follows:

  • Level 1 to 10: mode easy, nb. rooms = 5, quest length ranging from 1 to 5 as the difficulty increases;
  • Level 11 to 20: mode medium, nb. rooms = 10, quest length ranging from 2 to 10 as the difficulty increases;
  • Level 21 to 30: mode hard, nb. rooms = 20, quest length ranging from 3 to 20 as the difficulty increases;

where the different modes correspond to:

  • Easy: rooms are all empty except where the two objects are placed. Also, connections between rooms have no door.
  • Medium: adding closed doors and containers that might need to be open in order to find the object.
  • Hard: adding locked doors and containers (necessary keys will in the inventory) that might need to be unlocked (and open) in order to find the object.
textworld.challenges.treasure_hunter.make_game(mode, options)[source]

Make a Treasure Hunter game.

Parameters:
  • mode (str) –

    Mode for the game where

    • 'easy': rooms are all empty except where the two objects are placed. Also, connections between rooms have no door.
    • 'medium': adding closed doors and containers that might need to be open in order to find the object.
    • 'hard': adding locked doors and containers (necessary keys will in the inventory) that might need to be unlocked (and open) in order to find the object.
  • options (GameOptions) – For customizing the game generation (see textworld.GameOptions for the list of available options).
Return type:

Game

Returns:

Generated game.

A Simple Game

This simple game takes place in a typical house and consists in finding the right food item and cooking it.

Here’s the map of the house.

            Bathroom
                +
                |
                +
Bedroom +--+ Kitchen +----+ Backyard
                +              +
                |              |
                +              +
           Living Room       Garden
textworld.challenges.simple.build_argparser(parser=None)[source]
textworld.challenges.simple.make_game(settings, options=None)[source]

Make a simple game.

Parameters:
  • settings (Mapping[str, str]) – Difficulty settings (see notes).
  • options (Optional[GameOptions]) – For customizing the game generation (see textworld.GameOptions for the list of available options).
Return type:

Game

Returns:

Generated game.

Notes

The settings that can be provided are:

  • rewards : The reward frequency: dense, balanced, or sparse.
  • goal : The description of the game’s objective shown at the beginning of the game: detailed, bried, or none.
  • test : Whether this game should be drawn from the test distributions of games.