| … | … | @@ -295,17 +295,22 @@ def go_to_house(agent): |
| 295 | 295 | # reward = 1 |
| 296 | 296 | def go_to_diamonds(agent): |
| 297 | 297 | agent.sendCommand("chat go_to_diamonds") |
| 298 | observation = {} |
| 298 | 299 | curr_x, curr_y, curr_z = get_curr_loc(agent) |
| 299 | 300 | turn_to(agent, curr_x, curr_y, curr_z, diamond_x, diamond_y, diamond_z) |
| 300 | 301 | time.sleep(0.2) |
| 301 | 302 | agent.sendCommand("move 1") |
| 302 | 303 | action_complete = stop_condition(agent, "diamond_block") |
| 303 | 304 | if action_complete: |
| 305 | agent.sendCommand("attack 1") |
| 306 | time.sleep(0.2) |
| 307 | agent.sendCommand("attack 0") |
| 308 | time.sleep(0.2) |
| 304 | 309 | reward = 1 |
| 305 | 310 | relocate_agent(agent) |
| 311 | observation["outside"] = ["self", "house"] |
| 306 | 312 | else: |
| 307 | 313 | reward = 0 |
| 308 | | observation = {} |
| 309 | 314 | if not inside_house(curr_x, curr_z): |
| 310 | 315 | observation["outside"] = ["self", "house"] |
| 311 | 316 | if hold_key: |