forked from grantsrb/Gym-Snake
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
28 lines (25 loc) · 832 Bytes
/
test.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
import gym_snake.envs.snake_env
from gym_snake.envs.snake.view import LocalAction
from gym_snake.envs.snake.snake import Snake
import time
import numpy as np
env = gym_snake.envs.SnakeEnv(grid_size=[13, 13], unit_size=1, snake_size=2, unit_gap=0, action_transformer=LocalAction())
while True:
print("RESET")
obs = env.reset()
assert (np.asarray(obs).shape == (27, 27, 1))
while True:
obs, rewards, done, info = env.step(LocalAction.RIGHT+1)
print(rewards)
assert(np.asarray(obs).shape == (27, 27, 1))
#env.render()
if done:
break
# obs, rewards, done, info = env.step(LocalAction.RIGHT+1)
# if done:
# break
# obs, rewards, done, info = env.step(LocalAction.LEFT+1)
# if done:
# break
#
#