Skip to content

Commit

Permalink
Pacman starts in random locations in the grid
Browse files Browse the repository at this point in the history
  • Loading branch information
rusu24edward committed Apr 29, 2024
1 parent db0e243 commit 34550ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion abmarl/examples/sim/pacman.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def example_grid(self):
'F', 'F', 'F', 'F', 'B', 'W', '_'],
['_', 'W', 'F', 'W', 'W', 'F', 'W', 'W', 'W', 'F', 'W', 'F', 'W', 'W',
'W', 'F', 'W', 'W', 'F', 'W', '_'],
['_', 'W', 'F', 'F', 'W', 'F', 'F', 'F', 'F', 'F', 'P', 'F', 'F', 'F',
['_', 'W', 'F', 'F', 'W', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F',
'F', 'F', 'W', 'F', 'F', 'W', '_'],
['_', 'W', 'W', 'F', 'W', 'F', 'W', 'F', 'W', 'W', 'W', 'W', 'W', 'F',
'W', 'F', 'W', 'F', 'W', 'W', '_'],
Expand Down
21 changes: 15 additions & 6 deletions examples/rllib_pacman.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@


object_registry = {
'P': lambda n: PacmanAgent(
id='pacman',
encoding=1,
view_range=2,
render_color='yellow',
),
# 'P': lambda n: PacmanAgent(
# id='pacman',
# encoding=1,
# view_range=2,
# render_color='yellow',
# ),
'W': lambda n: WallAgent(
id=f'wall_{n}',
encoding=2,
Expand All @@ -32,11 +32,20 @@
render_color='r'
),
}
extra_agents = {
'pacman': PacmanAgent(
id='pacman',
encoding=1,
view_range=2,
render_color='yellow',
)
}
sim = MultiAgentWrapper(
AllStepManager(
PacmanSim.build_sim_from_array(
PacmanSim.example_grid,
object_registry,
extra_agents=extra_agents,
states={'PositionState', 'OrientationState', 'HealthState'},
observers={'AbsoluteEncodingObserver'},
overlapping={1: {3, 4}, 4: {3, 4}},
Expand Down

0 comments on commit 34550ae

Please sign in to comment.