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

fix: pacman ghost valid action calculations result in NaNs #241

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ problems.
| 🐍 Snake | Routing | `Snake-v1` | [code](https://github.com/instadeepai/jumanji/tree/main/jumanji/environments/routing/snake/) | [doc](https://instadeepai.github.io/jumanji/environments/snake/) |
| 📬 TSP (Travelling Salesman Problem) | Routing | `TSP-v1` | [code](https://github.com/instadeepai/jumanji/tree/main/jumanji/environments/routing/tsp/) | [doc](https://instadeepai.github.io/jumanji/environments/tsp/) |
| Multi Minimum Spanning Tree Problem | Routing | `MMST-v0` | [code](https://github.com/instadeepai/jumanji/tree/main/jumanji/environments/routing/mmst) | [doc](https://instadeepai.github.io/jumanji/environments/mmst/) |
| ᗧ•••ᗣ•• PacMan | Routing | `PacMan-v0` | [code](https://github.com/instadeepai/jumanji/tree/main/jumanji/environments/routing/pac_man/) | [doc](https://instadeepai.github.io/jumanji/environments/pac_man/)
| ᗧ•••ᗣ•• PacMan | Routing | `PacMan-v1` | [code](https://github.com/instadeepai/jumanji/tree/main/jumanji/environments/routing/pac_man/) | [doc](https://instadeepai.github.io/jumanji/environments/pac_man/)
| 👾 Sokoban | Routing | `Sokoban-v0` | [code](https://github.com/instadeepai/jumanji/tree/main/jumanji/environments/routing/sokoban/) | [doc](https://instadeepai.github.io/jumanji/environments/sokoban/) |

<h2 name="install" id="install">Installation 🎬</h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/environments/pac_man.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ Eating a ghost when scatter mode is enabled also awards +200 points but, points


## Registered Versions 📖
- `PacMan-v0`, PacMan in a 31x28 map with simple grid observations.
- `PacMan-v1`, PacMan in a 31x28 map with simple grid observations.
6 changes: 4 additions & 2 deletions jumanji/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@

# Sokoban with deepmind dataset generator
register(id="Sokoban-v0", entry_point="jumanji.environments:Sokoban")
# Pacman - minimal version of Atarti Pacman game
register(id="PacMan-v0", entry_point="jumanji.environments:PacMan")

# Pacman - minimal version of Atari Pacman game
register(id="PacMan-v1", entry_point="jumanji.environments:PacMan")

# SlidingTilePuzzle - A sliding tile puzzle environment with the default grid size of 5x5.
register(
id="SlidingTilePuzzle-v0", entry_point="jumanji.environments:SlidingTilePuzzle"
Expand Down
2 changes: 1 addition & 1 deletion jumanji/environments/routing/pac_man/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def get_valid_positions(pos: chex.Array) -> Any:
# Get distances of valid locations
valid_no_back_d = valid_no_back * ghost_dist
invert_mask = valid_no_back != 1
invert_mask = invert_mask * jnp.inf
invert_mask = jnp.where(invert_mask, jnp.inf, invert_mask)
# Set distance of all invalid areas to infinity
valid_no_back_d = valid_no_back_d + invert_mask
masked_dist = valid_no_back_d
Expand Down
2 changes: 1 addition & 1 deletion jumanji/training/configs/env/pac_man.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pac_man
registered_version: PacMan-v0
registered_version: PacMan-v1

network:
num_channels: [4,4,1]
Expand Down
Loading