Closed junkyul closed 2 years ago
TextWorld doesn't provide text that includes the game feedback integrated into the room observation. However, what people have been doing is concatenating (at each game step) the game's feedback, the room's description, and the player's inventory.
You can achieve that by requesting additional information from the environment (see textworld.EnvInfos) like so:
import textworld
requested_infos = textworld.EnvInfos(feedback=True, description=True, inventory=True)
env = textworld.start("path/to/game.z8", requested_infos)
state = env.reset()
# Build the observation string.
observation = state.feedback + "\n" + state.description + "\n" + state.inventory
print(observation)
# Take an action.
state, score, done = env.step("drop hat")
observation = state.feedback + "\n" + state.description + "\n" + state.inventory
print(observation)
________ ________ __ __ ________
| \| \| \ | \| \
\$$$$$$$$| $$$$$$$$| $$ | $$ \$$$$$$$$
| $$ | $$__ \$$\/ $$ | $$
| $$ | $$ \ >$$ $$ | $$
| $$ | $$$$$ / $$$$\ | $$
| $$ | $$_____ | $$ \$$\ | $$
| $$ | $$ \| $$ | $$ | $$
\$$ \$$$$$$$$ \$$ \$$ \$$
__ __ ______ _______ __ _______
| \ _ | \ / \ | \ | \ | \
| $$ / \ | $$| $$$$$$\| $$$$$$$\| $$ | $$$$$$$\
| $$/ $\| $$| $$ | $$| $$__| $$| $$ | $$ | $$
| $$ $$$\ $$| $$ | $$| $$ $$| $$ | $$ | $$
| $$ $$\$$\$$| $$ | $$| $$$$$$$\| $$ | $$ | $$
| $$$$ \$$$$| $$__/ $$| $$ | $$| $$_____ | $$__/ $$
| $$$ \$$$ \$$ $$| $$ | $$| $$ \| $$ $$
\$$ \$$ \$$$$$$ \$$ \$$ \$$$$$$$$ \$$$$$$$
Hey, thanks for coming over to the TextWorld today, there is something I need you to do for me. First of all, go east. After that, take the passkey from the trunk inside the laundry place. And then, unlock the box in the laundry place with the passkey. And once you've done that, you win!
-= Kitchen =-
You arrive in a kitchen. A standard one. I guess you better just go and list everything you see here.
You see an opened chest right there by you. The chest is empty! This is the worst thing that could possibly happen, ever!
There is a closed door leading south. There is an unguarded exit to the east.
-= Kitchen =-
You arrive in a kitchen. A standard one. I guess you better just go and list everything you see here.
You see an opened chest right there by you. The chest is empty! This is the worst thing that could possibly happen, ever!
There is a closed door leading south. There is an unguarded exit to the east.
You are carrying: a top hat.
after dropping the top hat:
You drop the top hat on the ground.
-= Kitchen =-
You arrive in a kitchen. A standard one. I guess you better just go and list everything you see here.
You see an opened chest right there by you. The chest is empty! This is the worst thing that could possibly happen, ever!
There is a closed door leading south. There is an unguarded exit to the east.
There is a top hat on the floor.
You are carrying nothing.
NB: the state.feedback
will be almost always the same as state.description
when you enter a room (i.e., after performing a go action). You can also see in the first observation
they both contain the initial room description at the first step.
Thanks very much!
From the documentation, description is the output of the look
command.
Does it mean Textworld internally calls the look
command after the command given by an agent?
Does this description have a template that translates the internal game state to the text format?
The current version of TextWorld relies on the compiled game (through Inform7) to generate text (including commands' feedback). This means that TextWorld does indeed issue a look
command under the hood but is not counted towards the number of moves taken. Same thing for inventory
.
Does this description have a template that translates the internal game state to the text format?
The AlfWorld version of TextWorld does have such a template but it is quite limited.
Thanks very much for your answer!
Hello, is there a way to generate a full description of each step instead of observing the changes since the previous step?
For example, we see an observation at the beginning of a game like
Then, after some action we observe
Would it be possible to get the full-textual description of each state from the internal game state?
Thanks!