Resetting Environment


Sometimes if the code breaks in middle of episode then env.reset() doesn’t work. Is it possible to go to Minecraft Home screen instead of closing the env env.close() and making it again?

env = gym.make(mission)
done = False

for e in episode(10):
     state, _ = env.reset()
     while not done:
             action = get_action(state)
             next_state, reward, done = env.step(action)
             state = next_state

Say if there’s error in action = get_action(state), I fix the error and run the for loop again, then the minecraft window stays same; nothing happens. I have to do env.close() and then run the code again for it to work again. Is there something I am doing wrong?

Also, is there any way to exit to Minecraft Home screen by just closing the mission and not exiting and restarting the game again?

What OS are you on? And the loop you’re referring to is the inner while loop? I tried reproducing what you’re talking about and it works fine for me. Do you also have a jupyter notebook or something where you can reproduce this error and we can try and fix it?


Hi Will,

I am on Windows 10. I was referring to outer for loop…as after fixing the error I would need to restart the episode. I have a jupyter notebook ready with the error. Since I cannot upload it here, i will create a issue on GitHub with notebook.

I found that if I wait for sometime like a minute or two before running the code again it works, else it gets stuck.