From f3d971bfe8cf3f98c5eb1d0b1bfce52c43ada8ad Mon Sep 17 00:00:00 2001 From: Martin Klissarov Date: Fri, 24 May 2024 10:31:15 -0700 Subject: [PATCH 1/4] Quick fix to allow using nethack config files --- nle/nethack/nethack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nle/nethack/nethack.py b/nle/nethack/nethack.py index d0e2091ed..1732f2045 100644 --- a/nle/nethack/nethack.py +++ b/nle/nethack/nethack.py @@ -206,7 +206,7 @@ def __init__( if options is None: options = NETHACKOPTIONS - self.options = list(options) + ["name:" + playername] + self.options = list(options) + ["name:" + playername] if options[0][0] != "@" else list(options) if playername.split("-", 1)[1:] == ["@"]: # Random role. Unless otherwise specified, randomize # race/gender/alignment too. From c92ee100a43fb07206c77fbe64f585e2377dec96 Mon Sep 17 00:00:00 2001 From: Martin Klissarov Date: Sat, 25 May 2024 14:05:46 -0700 Subject: [PATCH 2/4] formatting fix for options --- nle/nethack/nethack.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nle/nethack/nethack.py b/nle/nethack/nethack.py index 1732f2045..98ec38c07 100644 --- a/nle/nethack/nethack.py +++ b/nle/nethack/nethack.py @@ -206,7 +206,13 @@ def __init__( if options is None: options = NETHACKOPTIONS - self.options = list(options) + ["name:" + playername] if options[0][0] != "@" else list(options) + + self.options = ( + list(options) + ["name:" + playername] + if options[0][0] != "@" + else list(options) + ) + if playername.split("-", 1)[1:] == ["@"]: # Random role. Unless otherwise specified, randomize # race/gender/alignment too. From a41c3c1f2eaf0f39d0930f92a33ea7397a27c11e Mon Sep 17 00:00:00 2001 From: Martin Klissarov Date: Wed, 14 Aug 2024 15:35:20 -0700 Subject: [PATCH 3/4] Update README.md info about the config file --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f67f5ea6..90c67c71b 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,21 @@ $ python -m nle.scripts.plot steps ``` - +# Configuration file + +NetHack allows for players to modify some details about the configuration of the +game (see options [here](https://nethackwiki.com/wiki/Options)). Some of these +configs may relate to the kind of messages being shown, the visual appearance +of the game or define macro-actions. Most NetHack players use such configurations, +see [this](https://www.hardfought.org/userdata/b/bouquet/nethack/bouquet.nhrc) +for example. + +To leverage the full spectrum of possibilities offered by NetHack, the `options` +arugment in the NetHack [class definition](https://github.com/mklissa/nle/blob/main/nle/nethack/nethack.py#L165) +needs to receive the location the nethack config file, prefixed by `@`. +In the case where the config file is in the same directory as the launching script, +the `options` argument should receive a value of `@.nethackrc` where `.nethackrc` +is the name of the config file. # Contributing From c0c484118f3804d5768a4905517c175390ed26f1 Mon Sep 17 00:00:00 2001 From: Martin Klissarov Date: Wed, 14 Aug 2024 15:41:09 -0700 Subject: [PATCH 4/4] Added config comments to nethack.py --- nle/nethack/nethack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nle/nethack/nethack.py b/nle/nethack/nethack.py index 98ec38c07..576f0b9ab 100644 --- a/nle/nethack/nethack.py +++ b/nle/nethack/nethack.py @@ -207,6 +207,9 @@ def __init__( if options is None: options = NETHACKOPTIONS + # Check if the user has passed a configuration file to define the options. + # This is done by specifying the options variable as "@.nethackrc", + # where .nethackrc is the file containing the configs. self.options = ( list(options) + ["name:" + playername] if options[0][0] != "@"