夺旗¶

此环境属于 Atari 环境。请先阅读该页面以获取一般信息。
导入 |
|
---|---|
动作 |
离散 |
并行 API |
是 |
手动控制 |
否 |
智能体 |
|
智能体 |
2 |
动作形状 |
(1,) |
动作值 |
[0,9] |
观察形状 |
(210, 160, 3) |
观察值 |
(0,255) |
一场关于记忆和信息的战斗。
地图上隐藏着一面旗帜。你可以在地图中移动并检查其中的方块。如果找到了旗帜,你会得分(你的对手会受到惩罚)。如果是炸弹,你会被送回起始位置。否则,它会给你一个关于旗帜位置的提示,可能是方向或距离。你的玩家需要能够利用自己搜索和对手搜索的信息,以便快速有效地缩小旗帜的位置范围。
环境参数¶
环境参数是所有 Atari 环境共有的,并在 基础 Atari 文档 中进行了描述。
动作空间(最小)¶
在任何给定回合中,一个智能体可以从 10 种动作中选择一种。
动作 |
行为 |
---|---|
0 |
无操作 |
1 |
开火 |
2 |
向上移动 |
3 |
向右移动 |
4 |
向左移动 |
5 |
向下移动 |
6 |
向右上移动 |
7 |
向左上移动 |
8 |
向右下移动 |
9 |
向左下移动 |
版本历史¶
v2:最小动作空间 (1.18.0)
v1:整个 API 的重大更改 (1.4.0)
v0:初始版本发布 (1.0.0)
用法¶
AEC¶
from pettingzoo.atari import flag_capture_v2
env = flag_capture_v2.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()
并行¶
from pettingzoo.atari import flag_capture_v2
env = flag_capture_v2.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()