Update to current version of Gym

This commit is contained in:
Nicolai Czempin 2018-12-16 17:29:32 +01:00
parent 09fb6c0ace
commit e924e38e52

View File

@ -8,7 +8,7 @@ class TicTacToeEnv(gym.Env):
def __init__(self): def __init__(self):
self.action_space = spaces.Discrete(9) self.action_space = spaces.Discrete(9)
self.observation_space = spaces.Discrete(512*512*2) # flattened self.observation_space = spaces.Discrete(512*512*2) # flattened
def _step(self, action): def step(self, action):
done = False done = False
reward = 0 reward = 0
@ -46,12 +46,12 @@ class TicTacToeEnv(gym.Env):
done = True done = True
return self.state, reward, done, {} return self.state, reward, done, {}
def _reset(self): def reset(self):
self.state = {} self.state = {}
self.state['board'] = [0, 0, 0, 0, 0, 0, 0, 0, 0] self.state['board'] = [0, 0, 0, 0, 0, 0, 0, 0, 0]
self.state['on_move'] = 1 self.state['on_move'] = 1
return self.state return self.state
def _render(self, mode='human', close=False): def render(self, mode='human', close=False):
if close: if close:
return return
print("on move: " , self.state['on_move']) print("on move: " , self.state['on_move'])