-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathsimple_ffa_run.py
38 lines (31 loc) · 1.08 KB
/
simple_ffa_run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''An example to show how to set up an pommerman game programmatically'''
import pommerman
from pommerman import agents
def main():
'''Simple function to bootstrap a game.
Use this as an example to set up your training env.
'''
# Print all possible environments in the Pommerman registry
print(pommerman.REGISTRY)
# Create a set of agents (exactly four)
agent_list = [
agents.SimpleAgent(),
agents.RandomAgent(),
agents.SimpleAgent(),
agents.RandomAgent(),
# agents.DockerAgent("pommerman/simple-agent", port=12345),
]
# Make the "Free-For-All" environment using the agent list
env = pommerman.make('PommeFFACompetition-v0', agent_list)
# Run the episodes just like OpenAI Gym
for i_episode in range(1):
state = env.reset()
done = False
while not done:
env.render()
actions = env.act(state)
state, reward, done, info = env.step(actions)
print('Episode {} finished'.format(i_episode))
env.close()
if __name__ == '__main__':
main()