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.

65 lines
2.0 KiB

2 months ago
  1. import minigrid
  2. import gymnasium as gym
  3. import random
  4. import matplotlib.pyplot as plt
  5. from minigrid.wrappers import ImgObsWrapper, RGBImgPartialObsWrapper
  6. def main():
  7. #samples = random.choices([0.0, 1.0], weights=(0.25, 0.75), k=100_000_000)
  8. # print(samples)
  9. # print(sum(samples))
  10. #print(sum(samples) / len(samples))
  11. names = [
  12. "MiniGrid-Adv-8x8-v0",
  13. "MiniGrid-AdvSimple-8x8-v0",
  14. "MiniGrid-AdvSlippery-8x8-v0",
  15. "MiniGrid-AdvLava-8x8-v0",
  16. # "MiniGrid-SingleDoor-7x6-v0",
  17. # "MiniGrid-DoubleDoor-10x8-v0",
  18. # "MiniGrid-DoubleDoor-12x12-v0",
  19. # "MiniGrid-DoubleDoor-16x16-v0",
  20. # "MiniGrid-LavaSlipperyS12-v0",
  21. # "MiniGrid-LavaSlipperyS12-v1",
  22. # "MiniGrid-LavaSlipperyS12-v2",
  23. # "MiniGrid-LavaSlipperyS12-v3",
  24. # "MiniGrid-LavaCrossingS9N3-v0",
  25. # "MiniGrid-SimpleCrossingS9N3-v0",
  26. # "MiniGrid-ObstructedMaze-1Dlh-v0",
  27. # "MiniGrid-BlockedUnlockPickup-v0",
  28. # "MiniGrid-KeyCorridorS6R3-v0",
  29. # "MiniGrid-LockedRoom-v0",
  30. # "MiniGrid-KeyCorridorS3R1-v0",
  31. # "MiniGrid-LavaGapS7-v0",
  32. # "MiniGrid-DoorKey-8x8-v0",
  33. # "MiniGrid-Dynamic-Obstacles-8x8-v0",
  34. # "MiniGrid-Empty-Random-6x6-v0",
  35. # "MiniGrid-Fetch-6x6-N2-v0",
  36. # "MiniGrid-FourRooms-v0",
  37. # "MiniGrid-LavaGapS7-v0",
  38. # "MiniGrid-RedBlueDoors-6x6-v0",
  39. ]
  40. for name in names:
  41. env = gym.make(name)
  42. env = RGBImgPartialObsWrapper(env)
  43. env = ImgObsWrapper(env)
  44. env.reset()
  45. img = env.get_frame(highlight=False)
  46. plt.title(name)
  47. plt.imshow(img)
  48. f = open(F"{name}.txt", "w")
  49. f.write(env.printGrid(init=True))
  50. f.close()
  51. plt.show()
  52. if __name__ == '__main__':
  53. main()