Warlords¶

此环境是 Atari 环境 的一部分。请先阅读该页面以获取一般信息。
导入 |
|
---|---|
动作 |
离散 |
Parallel API |
是 |
手动控制 |
否 |
智能体 |
|
智能体 |
4 |
动作形状 |
(1,) |
动作值 |
[0,5] |
观测形状 |
(210, 160, 3) |
观测值 |
(0,255) |
四人混战,决出最后的胜利者!
保卫你的堡垒免受球的攻击,并将球击向你的对手。
当你的堡垒被摧毁时,你将获得 -1 的奖励并结束游戏。如果你是最后一个存活的玩家,你将获得 +1 的奖励。
环境参数¶
环境参数对所有 Atari 环境都是通用的,并在 Atari 基础文档 中进行描述。
动作空间(最小)¶
在任意回合中,智能体可以从 6 种动作中选择一种。
动作 |
行为 |
---|---|
0 |
无操作 |
1 |
发射 |
2 |
向上移动 |
3 |
向右移动 |
4 |
向左移动 |
5 |
向下移动 |
版本历史¶
v3:最小动作空间 (1.18.0)
v2:API 的重大更改 (1.4.0)
v1:修复了所有环境处理过早死亡的方式 (1.3.0)
v0:初始版本发布 (1.0.0)
用法¶
AEC¶
from pettingzoo.atari import warlords_v3
env = warlords_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 warlords_v3
env = warlords_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()