-
Notifications
You must be signed in to change notification settings - Fork 14
Seeding for generating levels #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ading / reloading shared library
heiner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
| chars: A row x columns numpy array of chars. | ||
| colors: A numpy array of colors (0-15), same shape as chars. | ||
| cursor: An optional (row, column) index for the cursor, | ||
| chars: A row x columns numpy array of chars. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an attempt to follow the Google Python style guide https://google.github.io/styleguide/pyguide.html#383-functions-and-methods
(no harm in changing the style here, but this is why it looked like that before).
| try { | ||
| lgen = pyLgen.cast<unsigned long>(); | ||
| } catch (py::cast_error) { | ||
| /* Is 0 a valid seed number? Does nothing even matter? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂
This feature adds the capability to pass an extra parameter
lgento the NLEseed()function for the purposes of having a deterministic dungeon layout, while allowing the in-game play to be randomly guided (e.g. combat etc.)It works by creating a new Random Number Generator using this seed value when the environment
reset()function is called. This RNG is swapped with the NetHackcoreRNG during the level generation (seemaklev.c:1003), where random numbers are sampled from the known RNG. It is then swapped back once the level is created (seemaklev.c:1041), and subsequent random numbers will be sampled fromcore.The RNGs are swapped again each time a new level is generated as the hero descends through the dungeon, ensuring that level generation random number sampling is kept separate from the in-game random number samples.