Skip to content
Snippets Groups Projects
Commit 9fbdfecb authored by Eric Hambro's avatar Eric Hambro
Browse files

Fix up the ifname in env file.

parent d13f6606
No related branches found
No related tags found
No related merge requests found
import aicrowd_gym import aicrowd_gym
import numpy as np import numpy as np
from tqdm import trange
from collections.abc import Iterable from collections.abc import Iterable
class BatchedEnv: class BatchedEnv:
...@@ -52,23 +52,15 @@ class BatchedEnv: ...@@ -52,23 +52,15 @@ class BatchedEnv:
if __name__ == '__main__': if __name__ == '__main__':
def nethack_make_fn():
return aicrowd_gym.make('NetHackChallenge-v0',
observation_keys=("glyphs",
"chars",
"colors",
"specials",
"blstats",
"message",
"tty_chars",
"tty_colors",
"tty_cursor",))
num_envs = 4 num_envs = 4
batched_env = BactchedEnv(env_make_fn=nethack_make_fn, num_envs=num_envs) batched_env = BatchedEnv(
env_make_fn=lambda:aicrowd_gym.make('NetHackChallenge-v0'),
num_envs=4
)
observations = batched_env.batch_reset() observations = batched_env.batch_reset()
num_actions = batched_env.envs[0].action_space.n num_actions = batched_env.envs[0].action_space.n
for _ in trange(10000000000000): for _ in range(50):
actions = np.random.randint(num_actions, size=num_envs) actions = np.random.randint(num_actions, size=num_envs)
observations, rewards, dones, infos = batched_env.batch_step(actions) observations, rewards, dones, infos = batched_env.batch_step(actions)
for done_idx in np.where(dones)[0]: for done_idx in np.where(dones)[0]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment