constants.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import numpy as np
  2. TILE_PIXELS = 32
  3. # Map of color names to RGB values
  4. COLORS = {
  5. "red": np.array([255, 0, 0]),
  6. "green": np.array([0, 255, 0]),
  7. "blue": np.array([0, 0, 255]),
  8. "purple": np.array([112, 39, 195]),
  9. "yellow": np.array([255, 255, 0]),
  10. "grey": np.array([100, 100, 100]),
  11. }
  12. COLOR_NAMES = sorted(list(COLORS.keys()))
  13. # Used to map colors to integers
  14. COLOR_TO_IDX = {"red": 0, "green": 1, "blue": 2, "purple": 3, "yellow": 4, "grey": 5}
  15. IDX_TO_COLOR = dict(zip(COLOR_TO_IDX.values(), COLOR_TO_IDX.keys()))
  16. # Map of object type to integers
  17. OBJECT_TO_IDX = {
  18. "unseen": 0,
  19. "empty": 1,
  20. "wall": 2,
  21. "floor": 3,
  22. "door": 4,
  23. "key": 5,
  24. "ball": 6,
  25. "box": 7,
  26. "goal": 8,
  27. "lava": 9,
  28. "agent": 10,
  29. }
  30. IDX_TO_OBJECT = dict(zip(OBJECT_TO_IDX.values(), OBJECT_TO_IDX.keys()))
  31. # Map of state names to integers
  32. STATE_TO_IDX = {
  33. "open": 0,
  34. "closed": 1,
  35. "locked": 2,
  36. }
  37. # Map of agent direction indices to vectors
  38. DIR_TO_VEC = [
  39. # Pointing right (positive X)
  40. np.array((1, 0)),
  41. # Down (positive Y)
  42. np.array((0, 1)),
  43. # Pointing left (negative X)
  44. np.array((-1, 0)),
  45. # Up (negative Y)
  46. np.array((0, -1)),
  47. ]