The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

32 lines
991 B

3 months ago
  1. from __future__ import annotations
  2. from minigrid.core.constants import COLOR_NAMES
  3. from minigrid.core.mission import MissionSpace
  4. from minigrid.core.roomgrid import RoomGrid
  5. from minigrid.core.world_object import Ball
  6. class AdversaryDoorPickup(AdversaryEnv):
  7. def __init__(self, max_steps: int | None = None, **kwargs):
  8. max_steps = 200
  9. super().__init__(
  10. mission_space=mission_space,
  11. width=11,
  12. num_cols=6,
  13. max_steps=max_steps,
  14. **kwargs,
  15. )
  16. def _gen_grid(self, width, height):
  17. super()._gen_grid(width, height)
  18. self.grid.vert_wall(int(width/2),0)
  19. def step(self, action):
  20. obs, reward, terminated, truncated, info = super().step(action)
  21. if action == self.actions.pickup:
  22. if self.carrying and self.carrying == self.obj:
  23. reward = self.goal_reward
  24. terminated = True
  25. return obs, reward, terminated, truncated, info