Interface for any agent playing TextWorld games.
act(obs, score, done, infos)¶
Acts upon the current list of observations.
One text command must be returned for each observation.
- obs (
str) – Previous command’s feedback (game’s narrative).
- score (
int) – The score obtained so far.
- done (
bool) – Whether the game is finished.
- infos (
Any]) – Additional information requested.
Text command to be performed. If episode has ended (i.e.
True), the returned value is expected to be ignored.
- obs (
Returns what additional information should be made available at each game step.
In addition to the standard information, certain games may have specific information that can be requested via the
extrasattribute. Refer to the documentation specific to the game to know more (see
Here is an example of how to request information and retrieve it.
>>> from textworld import EnvInfos >>> request_infos = EnvInfos(description=True, inventory=True) ... >>> env = gym.make(env_id) >>> ob, infos = env.reset() >>> print(infos["description"]) >>> print(infos["inventory"])