Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@ about the agent-environment interface, see the official [OpenAI Gym documentatio
import gym
import time

env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()

for i in range(100):
a = env.action_space.sample()
o, r, done, info = env.step(a)
env.render()
time.sleep(0.5) # otherwise the rendering is too fast for the human eye.
def run():
env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()

for i in range(100):
a = env.action_space.sample()
o, r, done, info = env.step(a)
env.render()
time.sleep(0.5) # otherwise the rendering is too fast for the human eye.

env.close()

if __name__ == '__main__':
run()
```
The above code would render the environment in your default web browser as shown in the image below:
![alt text](https://github.com/robinhenry/gym-anm/blob/master/docs/source/images/anm6-easy-example.png?raw=true)
Expand Down
22 changes: 14 additions & 8 deletions docs/source/topics/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ are randomly sampled from the action space at each time step: ::
import gym
import time

env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()

for i in range(100):
a = env.action_space.sample()
o, r, done, info = env.step(a)
env.render()
time.sleep(0.5) # otherwise the rendering is too fast for the human eye.
def run():
env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()

for i in range(100):
a = env.action_space.sample()
o, r, done, info = env.step(a)
env.render()
time.sleep(0.5) # otherwise the rendering is too fast for the human eye.

env.close()

if __name__ == '__main__':
run()

For more information about the Gym interface, read the `official documentation <https://github.com/openai/gym>`_.

Expand Down
2 changes: 1 addition & 1 deletion gym_anm/envs/anm6_env/rendering/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<link rel="stylesheet" href="css/styles.css">
<script>var wsServerAddress = "ws://127.0.0.1:64209/";</script>
<script>var wsServerAddress = "ws://127.0.0.1:9001/";</script>
<script src="js/init.js"></script>
<script src="js/devices.js"></script>
<script src="js/graph.js"></script>
Expand Down