TextWorld

class textworld.envs.tw.TextWorldEnv(infos=None)[source]

Bases: textworld.core.Environment

Environment for playing games by TextWorld.

Parameters

infos (Optional[EnvInfos]) – Information to be included in the game state. By default, only the game’s narrative is included.

copy()[source]

Return a copy of this environment.

It is safe to call step and reset on the copied environment.

Warning

The Game and Inform7Game private objects are soft copies.

Return type

TextWorldEnv

load(path)[source]

Loads a new text-based game.

Parameters

path (str) – Path to the game file to load.

Return type

None

reset()[source]

Starts game from the beginning.

Returns

Initial state of the game.

step(command)[source]

Performs a given command.

Parameters

command (str) – Text command to send to the interpreter.

Returns

A tuple containing the new game state, a reward for performing that command and reaching this new state, and whether the game is finished or not.