冰球¶

该环境是 Atari 环境 的一部分。请先阅读该页面以获取一般信息。
导入 |
|
---|---|
动作 |
离散 |
Parallel API |
是 |
手动控制 |
否 |
智能体 |
|
智能体 |
2 |
动作形状 |
(1,) |
动作值 |
[0,17] |
观测形状 |
(210, 160, 3) |
观测值 |
(0,255) |
一个关于控制和时机的竞技游戏。
当你进攻时,你必须在你的两名球员之间(你控制持球的那名)传球,以突破对手的防守。防守时,你控制直接在球前方的球员。两名球员都必须应对控制权的快速切换,同时绕过对手。如果你得分,你会获得+1奖励,你的对手-1。
环境参数¶
环境参数是所有 Atari 环境共有的,并在基础 Atari 文档中有所描述。
动作空间¶
在任何给定的回合中,智能体可以从18个动作中选择一个。
动作 |
行为 |
---|---|
0 |
无操作 |
1 |
射击 |
2 |
向上移动 |
3 |
向右移动 |
4 |
向左移动 |
5 |
向下移动 |
6 |
向右上移动 |
7 |
向左上移动 |
8 |
向右下移动 |
9 |
向左下移动 |
10 |
向上射击 |
11 |
向右射击 |
12 |
向左射击 |
13 |
向下射击 |
14 |
向右上射击 |
15 |
向左上射击 |
16 |
向右下射击 |
17 |
向左下射击 |
版本历史¶
v2: 最小动作空间 (1.18.0)
v1: 对整个 API 的重大更改 (1.4.0)
v0: 初始版本发布 (1.0.0)
用法¶
AEC¶
from pettingzoo.atari import ice_hockey_v2
env = ice_hockey_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()
Parallel¶
from pettingzoo.atari import ice_hockey_v2
env = ice_hockey_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()