Wizard of Wor¶

此环境属于 Atari 环境。请先阅读该页面以获取一般信息。
导入 |
from pettingzoo.atari import wizard_of_wor_v3 |
---|---|
动作 |
离散 |
Parallel API |
是 |
手动控制 |
否 |
智能体 |
agents= [‘first_0’, ‘second_0’] |
智能体 |
2 |
动作形状 |
(1,) |
动作值 |
[0,8] |
观察形状 |
(210, 160, 3) |
观察值 |
(0,255) |
与NPC和其他玩家战斗。仔细的时机选择和控制至关重要,同时也要注意你的对手。
你通过用子弹击中对手和NPC来得分。击中NPC得分在200到2500点之间,取决于NPC类型;击中玩家得分1000点。
如果你被子弹击中,你会失去一条生命。当两名玩家都失去3条生命时,游戏结束。
请注意,除了攻击其他玩家以获利的竞争性方面外,游戏还有一个合作性方面:清理关卡意味着两名玩家都将有更多得分机会。
环境参数¶
环境参数适用于所有 Atari 环境,并在基本 Atari 文档中有所描述。
动作空间¶
在任何给定的回合中,智能体可以从9种动作中选择一种。
动作 |
行为 |
---|---|
0 |
开火 |
1 |
向上移动 |
2 |
向右移动 |
3 |
向左移动 |
4 |
向下移动 |
5 |
向右上移动 |
6 |
向左上移动 |
7 |
向右下移动 |
8 |
向左下移动 |
版本历史¶
v3: 最小动作空间 (1.18.0)
v2: 整个 API 的破坏性变更 (1.4.0)
v1: 修复了所有环境处理过早死亡的方式 (1.3.0)
v0: 初始版本发布 (1.0.0)
用法¶
AEC¶
from pettingzoo.atari import wizard_of_wor_v3
env = wizard_of_wor_v3.env(render_mode="human")
env.reset(seed=42)
for agent in env.agent_iter():
observation, reward, termination, truncation, info = env.last()
if termination or truncation:
action = None
else:
# this is where you would insert your policy
action = env.action_space(agent).sample()
env.step(action)
env.close()
Parallel¶
from pettingzoo.atari import wizard_of_wor_v3
env = wizard_of_wor_v3.parallel_env(render_mode="human")
observations, infos = env.reset()
while env.agents:
# this is where you would insert your policy
actions = {agent: env.action_space(agent).sample() for agent in env.agents}
observations, rewards, terminations, truncations, infos = env.step(actions)
env.close()