Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the ability to save and load game state for environments. This allows games to be paused and resumed from the saved state.
This leverages how save scumming can be done, as described here https://nethackwiki.com/wiki/Save_scumming
basically all the files from HACKDIR are copied to separate directory. Then if someone wants to load the game it's enough to copy back the files and create new nethack game. Unfortunately game has to be turned off and on to do so.
Disclaimer: I am not sure if my changes in _new_dl don't break something else, I don't really understand what is happening there and why.
Example usage (from added test)
Use cases
I used this to evaluate trained agents starting from different levels in the dungeon. For example Sokoban https://nethackwiki.com/wiki/Sokoban. I thought I could share my code and contribute back to the community.