Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Heiner/addhow #160

Merged
merged 4 commits into from
Jun 4, 2021
Merged

Heiner/addhow #160

merged 4 commits into from
Jun 4, 2021

Conversation

heiner
Copy link
Contributor

@heiner heiner commented Jun 4, 2021

No description provided.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 4, 2021
@heiner heiner requested a review from cdmatters June 4, 2021 12:42
v_h.set_holder_constructed(true);
},
py::detail::is_new_style_constructor())
.def(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why clang-format decided to change this.

I wish it was more stable version by version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up that you should install clang-format in your conda env (conda install clang-format) to get a recent version, since I've noticed system package managers seem to have very old versions.

@@ -16,6 +16,7 @@ typedef struct nle_observation {
int action;
int done;
char in_normal_game; /* Bool indicating if other obs are set. */
int how_done; /* If game is really_done, how it ended. */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a game_end_types but I think it's better to keep this file standalone.

game_end_types
how_done()
{
return static_cast<game_end_types>(obs_.how_done);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be 0 (DIED) by default, even when the game hasn't finished yet. The way this is done here is that it has to be a member of game_end_types, which has no value for "not yet ended".

Heinrich Kuttler added 2 commits June 4, 2021 17:09
What exactly NH means by score is a bit context-dependent. The value
u.urexp factors into botl_score() in botl.c (if enabled) as well as
into the computation in really_done() in end.c. In many cases, the
result of botl_score() will be what really_done() reports as the
end-of-game score. In many other cases, it won't: E.g. after dying
(not quitting, escaping, ascending or bug-related exits), score for
acquired gold is reduced by 10%. Also if escaped or ascended, valuable
gems, artefacts etc will give extra score. The computation in end.c
adds to u.urexp, which will reflect the end-of-game score for a few
briefs "steps" at the very end of the game (but not before).
Copy link
Contributor

@cdmatters cdmatters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me and an important addition!

@@ -224,3 +224,6 @@ def get_current_seeds(self):

def in_normal_game(self):
return self._pynethack.in_normal_game()

def how_done(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this crash if its done outside of the end game?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but it will return game_end_types.DIED which corresponds to 0.

@@ -73,6 +73,8 @@ vt_char_color_extract(TMTCHAR *c)
case (TMT_COLOR_WHITE):
color = (c->a.bold) ? CLR_WHITE : CLR_GRAY; // c = 15:7
break;
case (TMT_COLOR_MAX):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is kind of wild but iirc TMT_COLOR_MAX.... i think is actually passed in sometime (by tmt)?!?! Really wild. I may be wrong but my some distant memory is recalling a really bonkers thing with tmt around here... maybe i used to have an assert i got rid of? i cant remember

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a helpful comment? probably not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this b/c the compiler doesn't like not checking all enum values. If we should do something special here, let me know.

@@ -256,6 +256,8 @@ NetHackRL::fill_obs(nle_obs *obs)
obs->internal[5] = nle_seeds[0]; /* core */
obs->internal[6] = nle_seeds[1]; /* disp */
obs->internal[7] = u.uhunger;
obs->internal[8] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add u.urexp here, but we;re not using it anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we at some point decided to use NetHack's "end of game" score, we would get it from here. See the commit message here c5f077c for details.

@heiner heiner merged commit cf877c2 into master Jun 4, 2021
@heiner heiner deleted the heiner/addhow branch June 4, 2021 18:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants