最新版gym-0.26.2中Atari环境下各游戏在不同模式和困难度下的遍历
最新版gym-0.26.2下Atari环境的安装以及环境版本v0,v4,v5的说明
===========================================
gym中Atari游戏共收录62个游戏,具体见:
https://www.gymlibrary.dev/environments/atari/complete_list/
以SpaceInvaders游戏为例,我们可以通过该游戏在gym上的主页说明获得该游戏的具体设置:
https://www.gymlibrary.dev/environments/atari/space_invaders/
=====================================================
关于游戏mode的设置,见官网文档:
https://www.gymlibrary.dev/environments/atari/#flavors
关于游戏在不同mode下的difficulties见官方文档:
https://github.com/mgbellemare/Arcade-Learning-Environment/blob/master/docs/games.md
=====================================================
根据gym中Atari游戏的官方文档,给出各游戏在不同模式和困难度下的遍历的代码:
flavors={ "ALE/Adventure-v5":{"modes":[0, 1, 2], "difficulties":list(range(4)), "default_mode":0}, "ALE/AirRaid-v5":{"modes":[1,2,3,4,5,6,7,8], "difficulties":[0], "default_mode":1}, "ALE/Alien-v5":{"modes":[0,1,2,3], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Amidar-v5":{"modes":[0], "difficulties":[0,3], "default_mode":0}, "ALE/Assault-v5":{"modes":[0], "difficulties":[0], "default_mode":0}, "ALE/Asterix-v5":{"modes":[0], "difficulties":[0], "default_mode":0}, "ALE/Asteroids-v5":{"modes":list(range(32))+[128,], "difficulties":[0,3], "default_mode":0}, "ALE/Atlantis-v5":{"modes":[0,1,2,3], "difficulties":[0], "default_mode":0}, "ALE/BankHeist-v5":{"modes":[0, 4, 8, 12, 16, 20, 24, 28], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/BattleZone-v5":{"modes":[1,2,3], "difficulties":[0], "default_mode":1}, "ALE/BeamRider-v5":{"modes":[0,], "difficulties":[0,1], "default_mode":0}, "ALE/Berzerk-v5":{"modes":[1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18], "difficulties":[0], "default_mode":1}, "ALE/Bowling-v5":{"modes":[0, 2, 4], "difficulties":[0,1], "default_mode":0}, "ALE/Boxing-v5":{"modes":[0,], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Breakout-v5":{"modes":[0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44], "difficulties":[0,1], "default_mode":0}, "ALE/Carnival-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/Centipede-v5":{"modes":[22,86], "difficulties":[0,], "default_mode":22}, "ALE/ChopperCommand-v5":{"modes":[0,2], "difficulties":[0,1], "default_mode":0}, "ALE/CrazyClimber-v5":{"modes":[0,1,2,3], "difficulties":[0,1], "default_mode":0}, "ALE/Defender-v5":{"modes":list(range(1,10))+[16,], "difficulties":[0,1], "default_mode":1}, "ALE/DemonAttack-v5":{"modes":[1, 3, 5, 7], "difficulties":[0,1], "default_mode":1}, "ALE/DoubleDunk-v5":{"modes":list(range(16)), "difficulties":[0], "default_mode":0}, "ALE/ElevatorAction-v5":{"modes":[0], "difficulties":[0,], "default_mode":0}, "ALE/Enduro-v5":{"modes":[0], "difficulties":[0,], "default_mode":0}, "ALE/FishingDerby-v5":{"modes":[0], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Freeway-v5":{"modes":list(range(8)), "difficulties":[0,1], "default_mode":0}, "ALE/Frostbite-v5":{"modes":[0, 2], "difficulties":[0,], "default_mode":0}, "ALE/Gopher-v5":{"modes":[0, 2], "difficulties":[0,1], "default_mode":0}, "ALE/Gravitar-v5":{"modes":[0,1,2,3,4], "difficulties":[0,], "default_mode":0}, "ALE/Hero-v5":{"modes":[0,1,2,3,4], "difficulties":[0,], "default_mode":0}, "ALE/IceHockey-v5":{"modes":[0,2], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Jamesbond-v5":{"modes":[0,1], "difficulties":[0,], "default_mode":0}, "ALE/JourneyEscape-v5":{"modes":[0,], "difficulties":[0,1], "default_mode":0}, "ALE/Kangaroo-v5":{"modes":[0,1], "difficulties":[0,], "default_mode":0}, "ALE/Krull-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/KungFuMaster-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/MontezumaRevenge-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/MsPacman-v5":{"modes":[0,1,2,3], "difficulties":[0,], "default_mode":0}, "ALE/NameThisGame-v5":{"modes":[8,24,40], "difficulties":[0,1], "default_mode":8}, "ALE/Phoenix-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/Pitfall-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/Pong-v5":{"modes":[0,1], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Pooyan-v5":{"modes":[10, 30, 50, 70], "difficulties":[0,], "default_mode":10}, "ALE/PrivateEye-v5":{"modes":[0,1,2,3,4], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Qbert-v5":{"modes":[0,], "difficulties":[0,1], "default_mode":0}, "ALE/Riverraid-v5":{"modes":[0,], "difficulties":[0,1], "default_mode":0}, "ALE/RoadRunner-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/Robotank-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/Seaquest-v5":{"modes":[0,], "difficulties":[0,1], "default_mode":0}, "ALE/Skiing-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/Solaris-v5":{"modes":[0,], "difficulties":[0,], "default_mode":0}, "ALE/SpaceInvaders-v5":{"modes":list(range(16)), "difficulties":[0,1], "default_mode":0}, "ALE/StarGunner-v5":{"modes":[0,1,2,3], "difficulties":[0,], "default_mode":0}, "ALE/Tennis-v5":{"modes":[0,2], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/TimePilot-v5":{"modes":[0,], "difficulties":[0,1,2], "default_mode":0}, "ALE/Tutankham-v5":{"modes":[0, 4, 8, 12], "difficulties":[0,], "default_mode":0}, "ALE/UpNDown-v5":{"modes":[0,], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/Venture-v5":{"modes":[0,], "difficulties":[0,1,2,3], "default_mode":0}, "ALE/VideoPinball-v5":{"modes":[0,2], "difficulties":[0,1], "default_mode":0}, "ALE/WizardOfWor-v5":{"modes":[0,], "difficulties":[0,1], "default_mode":0}, "ALE/YarsRevenge-v5":{"modes":[0, 32, 64, 96], "difficulties":[0,1], "default_mode":0}, "ALE/Zaxxon-v5":{"modes":[0,8,16,24], "difficulties":[0,], "default_mode":0}, } import gym num = 0 for game_name, game_profile in flavors.items(): for mode in game_profile['modes']: for difficulty in game_profile['difficulties']: try: env = gym.make(game_name, mode=mode, difficulty=difficulty) obs = env.reset() for i in range(10): action = env.action_space.sample() obs, reward, done, _, _ = env.step(action) env.close() except Exception as e: num += 1 print(e, game_name, mode, difficulty) # print(env) print("error game number: ", num)
运行结果:
================================================
posted on 2022-11-28 09:26 Angry_Panda 阅读(602) 评论(0) 编辑 收藏 举报