Skip to content

Commit

Permalink
fix: Sometimes out of bounds actions crash if not using masking
Browse files Browse the repository at this point in the history
  • Loading branch information
strakam committed Mar 8, 2025
1 parent 820d926 commit 98214a1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions generals/core/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def step(self, actions: dict[str, Action]) -> tuple[dict[str, Observation], dict
# Skip if the destination cell is not passable or out of bounds
out_of_i = di < 0 or di >= self.grid_dims[0]
out_of_j = dj < 0 or dj >= self.grid_dims[1]
not_passable = self.channels.passable[di, dj] == 0
if out_of_i or out_of_j or not_passable:
if out_of_i or out_of_j or self.channels.passable[di, dj] == 0:
continue

# Figure out the target square owner and army size
Expand Down

0 comments on commit 98214a1

Please sign in to comment.