Foozpong¶

此环境是 Atari 环境的一部分。请先阅读该页面以获取一般信息。
导入 |
|
---|---|
动作 |
离散 |
Parallel API |
是 |
手动控制 |
否 |
智能体 |
|
智能体 |
4 |
动作形状 |
(1,) |
动作值 |
[0,5] |
观测形状 |
(210, 160, 3) |
观测值 |
(0,255) |
四人团队战。
将球传过对手的防守球员到达得分区域。就像传统的桌上足球一样,棋盘在球门区域之间有两队交替放置的球拍层。要玩好这款游戏,每边的两名玩家必须协调,让球在这些层之间向上移动到对手的得分区域。具体来说,first_0
和 third_0
在一队,而 second_0
和 fourth_0
在另一队。
得分后,你的队伍获得 +1 奖励,对手队伍获得 -1 奖励。
发球有时间限制:如果玩家在接到球后 2 秒内没有发球,他们的队伍将扣除 -1 分,并且计时器重置。这可以防止一名玩家无限期地拖延比赛,但也意味着它不再是纯粹的零和游戏。
环境参数¶
一些环境参数是所有 Atari 环境共有的,并在基础 Atari 文档中描述。
Foozpong 特有的参数是
foozpong_v3.env(num_players=4)
num_players
: 玩家数量(必须为 2 或 4)
动作空间(最小)¶
在任何给定回合中,智能体可以从 6 个动作中选择一个。
动作 |
行为 |
---|---|
0 |
无操作 |
1 |
发射 |
2 |
向上移动 |
3 |
向右移动 |
4 |
向左移动 |
5 |
向下移动 |
版本历史¶
v3: 最小动作空间 (1.18.0)
v2: 无动作计时器 (1.9.0)
v1: 整个 API 的破坏性更改 (1.4.0)
v0: 初始版本发布 (1.0.0)
用法¶
AEC¶
from pettingzoo.atari import foozpong_v3
env = foozpong_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 foozpong_v3
env = foozpong_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()