Skip to content

Instantly share code, notes, and snippets.

@vzhong
Last active August 11, 2023 19:18
Show Gist options
  • Save vzhong/1094f74f9e448693b8647c2c56891afe to your computer and use it in GitHub Desktop.
Save vzhong/1094f74f9e448693b8647c2c56891afe to your computer and use it in GitHub Desktop.
potential ScienceWorld bug
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from scienceworld import ScienceWorldEnv\n",
"env = ScienceWorldEnv()\n",
"env.load('boil', 0, generateGoldPath=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"****************************************************************************************************\n",
"TURN 0 GOLD ACTION open door to kitchen\n",
"The door is now open.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 1 GOLD ACTION go to kitchen\n",
"You move to the kitchen.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 2 GOLD ACTION look around\n",
"This room is called the kitchen. In it, you see: \n",
"\tthe agent\n",
"\ta substance called air\n",
"\ta chair. On the chair is: nothing.\n",
"\ta counter. On the counter is: a bowl (containing a red apple, a banana, an orange, a potato), a drawer.\n",
"\ta cupboard. The cupboard door is closed. \n",
"\ta freezer. The freezer door is closed. \n",
"\ta fridge. The fridge door is closed. \n",
"\ta glass jar (containing a substance called sodium chloride)\n",
"\ta lighter\n",
"\ta oven, which is turned off. The oven door is closed. \n",
"\ta painting\n",
"\ta sink, which is turned off. In the sink is: nothing.\n",
"\ta substance called soap\n",
"\ta stopwatch, which is deactivated. \n",
"\ta stove, which is turned off. On the stove is: nothing.\n",
"\ta table. On the table is: a glass cup (containing nothing).\n",
"\ta thermometer, currently reading a temperature of 10 degrees celsius\n",
"You also see:\n",
"\tA door to the bathroom (that is closed)\n",
"\tA door to the hallway (that is open)\n",
"\tA door to the outside (that is closed)\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 3 GOLD ACTION pick up thermometer\n",
"You move the thermometer to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 4 GOLD ACTION open cupboard\n",
"The cupboard is now open.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 5 GOLD ACTION pick up metal pot\n",
"You move the metal pot to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 6 GOLD ACTION look around\n",
"This room is called the kitchen. In it, you see: \n",
"\tthe agent\n",
"\ta substance called air\n",
"\ta chair. On the chair is: nothing.\n",
"\ta counter. On the counter is: a bowl (containing a red apple, a banana, an orange, a potato), a drawer.\n",
"\ta cupboard. The cupboard door is open. In the cupboard is: a ceramic cup (containing nothing), a drawer, a tin cup (containing nothing).\n",
"\ta freezer. The freezer door is closed. \n",
"\ta fridge. The fridge door is closed. \n",
"\ta glass jar (containing a substance called sodium chloride)\n",
"\ta lighter\n",
"\ta oven, which is turned off. The oven door is closed. \n",
"\ta painting\n",
"\ta sink, which is turned off. In the sink is: nothing.\n",
"\ta substance called soap\n",
"\ta stopwatch, which is deactivated. \n",
"\ta stove, which is turned off. On the stove is: nothing.\n",
"\ta table. On the table is: a glass cup (containing nothing).\n",
"You also see:\n",
"\tA door to the bathroom (that is closed)\n",
"\tA door to the hallway (that is open)\n",
"\tA door to the outside (that is closed)\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 7 GOLD ACTION move metal pot to sink\n",
"You move the metal pot to the sink.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 8 GOLD ACTION activate sink\n",
"The sink is now activated.\n",
"3 False\n",
"****************************************************************************************************\n",
"TURN 9 GOLD ACTION deactivate sink\n",
"The sink is now deactivated.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 10 GOLD ACTION pick up metal pot\n",
"You move the metal pot to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 11 GOLD ACTION focus on substance in metal pot\n",
"You focus on the water.\n",
"67 False\n",
"****************************************************************************************************\n",
"TURN 12 GOLD ACTION pour metal pot into metal pot\n",
"You can't move something into itself.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 13 GOLD ACTION pick up metal pot\n",
"You move the metal pot to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 14 GOLD ACTION move metal pot to stove\n",
"You move the metal pot to the stove.\n",
"2 False\n",
"****************************************************************************************************\n",
"TURN 15 GOLD ACTION activate stove\n",
"The stove is now activated.\n",
"1 False\n",
"****************************************************************************************************\n",
"TURN 16 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 17 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 13 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 18 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 19 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 20 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 20 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 21 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 28 degrees celsius\n",
"2 False\n",
"****************************************************************************************************\n",
"TURN 22 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 23 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 38 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 24 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 25 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 48 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 26 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 27 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 58 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 28 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 29 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 68 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 30 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 31 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 78 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 32 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 33 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 88 degrees celsius\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 34 GOLD ACTION examine substance in metal pot\n",
"a substance called water\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 35 GOLD ACTION use thermometer in inventory on substance in metal pot\n",
"the thermometer measures a temperature of 98 degrees celsius\n",
"25 True\n",
"****************************************************************************************************\n",
"TURN 36 GOLD ACTION examine steam\n",
"a substance called steam\n",
"0 True\n",
"****************************************************************************************************\n",
"TURN 37 GOLD ACTION use thermometer in inventory on steam\n",
"the thermometer measures a temperature of 107 degrees celsius\n",
"0 True\n",
"****************************************************************************************************\n",
"TURN 38 GOLD ACTION wait1\n",
"You decide to wait for 1 iterations.\n",
"0 True\n"
]
}
],
"source": [
"gold = env.getGoldActionSequence()\n",
"\n",
"def do(env, action):\n",
" obs, reward, terminated, info = env.step(action)\n",
" print(obs)\n",
" print(reward, terminated)\n",
"\n",
"for i, a in enumerate(gold):\n",
" print('*' * 100)\n",
" print('TURN {} GOLD ACTION {}'.format(i, a))\n",
" do(env, a)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['open door to kitchen',\n",
" 'go to kitchen',\n",
" 'look around',\n",
" 'pick up thermometer',\n",
" 'open cupboard',\n",
" 'pick up metal pot',\n",
" 'look around',\n",
" 'move metal pot to sink',\n",
" 'activate sink',\n",
" 'deactivate sink',\n",
" 'pick up metal pot',\n",
" 'focus on substance in metal pot',\n",
" 'pour metal pot into metal pot',\n",
" 'pick up metal pot',\n",
" 'move metal pot to stove',\n",
" 'activate stove',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine substance in metal pot',\n",
" 'use thermometer in inventory on substance in metal pot',\n",
" 'examine steam',\n",
" 'use thermometer in inventory on steam',\n",
" 'wait1']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gold"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"****************************************************************************************************\n",
"TURN 0 USER ACTION open door to kitchen\n",
"The door is now open.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 1 USER ACTION go to kitchen\n",
"You move to the kitchen.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 2 USER ACTION look around\n",
"This room is called the kitchen. In it, you see: \n",
"\tthe agent\n",
"\ta substance called air\n",
"\ta chair. On the chair is: nothing.\n",
"\ta counter. On the counter is: a bowl (containing a red apple, a banana, an orange, a potato), a drawer.\n",
"\ta cupboard. The cupboard door is closed. \n",
"\ta freezer. The freezer door is closed. \n",
"\ta fridge. The fridge door is closed. \n",
"\ta glass jar (containing a substance called sodium chloride)\n",
"\ta lighter\n",
"\ta oven, which is turned off. The oven door is closed. \n",
"\ta painting\n",
"\ta sink, which is turned off. In the sink is: nothing.\n",
"\ta substance called soap\n",
"\ta stopwatch, which is deactivated. \n",
"\ta stove, which is turned off. On the stove is: nothing.\n",
"\ta table. On the table is: a glass cup (containing nothing).\n",
"\ta thermometer, currently reading a temperature of 10 degrees celsius\n",
"You also see:\n",
"\tA door to the bathroom (that is closed)\n",
"\tA door to the hallway (that is open)\n",
"\tA door to the outside (that is closed)\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 3 USER ACTION pick up thermometer\n",
"You move the thermometer to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 4 USER ACTION open cupboard\n",
"The cupboard is now open.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 5 USER ACTION pick up metal pot\n",
"You move the metal pot to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 6 USER ACTION look around\n",
"This room is called the kitchen. In it, you see: \n",
"\tthe agent\n",
"\ta substance called air\n",
"\ta chair. On the chair is: nothing.\n",
"\ta counter. On the counter is: a bowl (containing a red apple, a banana, an orange, a potato), a drawer.\n",
"\ta cupboard. The cupboard door is open. In the cupboard is: a ceramic cup (containing nothing), a drawer, a tin cup (containing nothing).\n",
"\ta freezer. The freezer door is closed. \n",
"\ta fridge. The fridge door is closed. \n",
"\ta glass jar (containing a substance called sodium chloride)\n",
"\ta lighter\n",
"\ta oven, which is turned off. The oven door is closed. \n",
"\ta painting\n",
"\ta sink, which is turned off. In the sink is: nothing.\n",
"\ta substance called soap\n",
"\ta stopwatch, which is deactivated. \n",
"\ta stove, which is turned off. On the stove is: nothing.\n",
"\ta table. On the table is: a glass cup (containing nothing).\n",
"You also see:\n",
"\tA door to the bathroom (that is closed)\n",
"\tA door to the hallway (that is open)\n",
"\tA door to the outside (that is closed)\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 7 USER ACTION move metal pot to sink\n",
"You move the metal pot to the sink.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 8 USER ACTION activate sink\n",
"The sink is now activated.\n",
"3 False\n",
"****************************************************************************************************\n",
"TURN 9 USER ACTION deactivate sink\n",
"The sink is now deactivated.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 10 USER ACTION pick up metal pot\n",
"You move the metal pot to the inventory.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 11 USER ACTION move metal pot to stove\n",
"You move the metal pot to the stove.\n",
"0 False\n",
"****************************************************************************************************\n",
"TURN 12 USER ACTION activate stove\n",
"The stove is now activated.\n",
"2 False\n"
]
}
],
"source": [
"env.load('boil', 0, generateGoldPath=True)\n",
"obs, info = env.reset()\n",
"\n",
"actions = [\n",
" 'open door to kitchen',\n",
" 'go to kitchen',\n",
" 'look around',\n",
" 'pick up thermometer',\n",
" 'open cupboard',\n",
" 'pick up metal pot',\n",
" 'look around',\n",
" 'move metal pot to sink',\n",
" 'activate sink',\n",
" 'deactivate sink',\n",
" 'pick up metal pot',\n",
" 'move metal pot to stove',\n",
" 'activate stove',\n",
"]\n",
"for i, a in enumerate(actions):\n",
" print('*' * 100)\n",
" print('TURN {} USER ACTION {}'.format(i, a))\n",
" do(env, a)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"You decide to wait for 10 iterations.\n",
"0 False\n",
"the thermometer measures a temperature of 58 degrees celsius\n",
"0 False\n"
]
}
],
"source": [
"do(env, 'wait')\n",
"do(env, 'use thermometer in inventory on substance in metal pot')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"You decide to wait for 10 iterations.\n",
"0 False\n",
"the thermometer measures a temperature of 115 degrees celsius\n",
"0 False\n"
]
}
],
"source": [
"do(env, 'wait')\n",
"do(env, 'use thermometer in inventory on substance in metal pot')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment