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

Wizkit support #78

Merged
merged 6 commits into from
Sep 23, 2020
Merged

Wizkit support #78

merged 6 commits into from
Sep 23, 2020

Conversation

yobibyte
Copy link
Contributor

This PR enables wizkit. To use, we need to pass a list of items to the env.reset(wizkit=list_of_items). Tests added.

@yobibyte yobibyte requested a review from heiner September 23, 2020 09:07
@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 Sep 23, 2020
Copy link
Contributor

@heiner heiner left a comment

Choose a reason for hiding this comment

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

Generally looks good. Small comment below.

nle/env/base.py Outdated
@@ -348,7 +352,7 @@ def _in_moveloop(self, observation):
program_state = observation[self._program_state_index]
return program_state[3] # in_moveloop

def reset(self):
def reset(self, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

I would slightly prefer not to *args, **kwargs this but to spell out whatever legal argument we expect -- in this case, only wizkid?

Copy link
Contributor

@heiner heiner left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@@ -269,6 +269,10 @@ def _get_observation(self, observation):
for key, i in zip(self._original_observation_keys, self._original_indices)
}

def _print_action_meanings(self):
for a_idx, a in enumerate(self._actions):
print(a_idx, a)
Copy link
Contributor

Choose a reason for hiding this comment

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

We have something similar when you play via python nle/scripts/play.py, but if you find this helpful, why not.

Generally we try to use _ for pseudo-private methods, so this might be better w/o the underscore?

The same goes for tests btw -- we are not 100% strict about this, but I'd prefer there to be no access to underscored variables/functions in tests, as this breaks encapsulation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the underscore from the method's name.

How do you write unit tests for some internal behaviour of an object without accessing internal fields?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

That's a great question and as I said we're not 100% strict about that. But my idea would be that unit tests should test public behavior, not their private implementation.

More on this idea here: https://testing.googleblog.com/2015/01/testing-on-toilet-prefer-testing-public.html?m=1

@yobibyte yobibyte merged commit 3465b9a into master Sep 23, 2020
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.

3 participants