forked from OpenGenerativeAI/llm-colosseum
-
Notifications
You must be signed in to change notification settings - Fork 5
/
simple.py
34 lines (25 loc) · 784 Bytes
/
simple.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
#!/usr/bin/env python3
import diambra.arena
def main():
# Environment creation
env = diambra.arena.make("sfiii3n", render_mode="human")
# Environment reset
observation, info = env.reset(seed=42)
# Agent-Environment interaction loop
while True:
# (Optional) Environment rendering
env.render()
# Action random sampling
actions = env.action_space.sample()
# Environment stepping
observation, reward, terminated, truncated, info = env.step(actions)
# Episode end (Done condition) check
if terminated or truncated:
observation, info = env.reset()
break
# Environment shutdown
env.close()
# Return success
return 0
if __name__ == '__main__':
main()