Skip to content
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

mask fixes #78

Merged
merged 19 commits into from
Sep 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
put back move no-op
  • Loading branch information
kywch committed Sep 2, 2023
commit 04026a1a3fa71e8e560cf38e35a3b22671d2fcc9
10 changes: 1 addition & 9 deletions nmmo/core/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,9 @@ def _make_move_mask(self):
return mask

# pylint: disable=not-an-iterable
mask = np.array([self.tile(*d.delta).material_id in material.Habitable.indices
return np.array([self.tile(*d.delta).material_id in material.Habitable.indices
for d in action.Direction.edges], dtype=np.int8)

if sum(mask) <= 1:
# if only the stay (no-op) is possible, then allow all actions
mask[:] = 1
# Mask the no-op option, since there should be at least one allowed move
mask[-1] = 0

return mask

def _make_attack_mask(self):
# NOTE: Currently, all attacks have the same range
# if we choose to make ranges different, the masks
Expand Down