def step(self, action):
    s = self.canvas.coords(self.rect)
    base_action = np.array([0, 0])
    if (action == 0):
        if (s[1] > UNIT):
            base_action[1] -= UNIT
    elif (action == 1):
        if (s[1] < ((MAZE_H - 1) * UNIT)):
            base_action[1] += UNIT
    elif (action == 2):
        if (s[0] < ((MAZE_W - 1) * UNIT)):
            base_action[0] += UNIT
    elif (action == 3):
        if (s[0] > UNIT):
            base_action[0] -= UNIT
    self.canvas.move(self.rect, base_action[0], base_action[1])
    s_ = self.canvas.coords(self.rect)
    if (s_ == self.canvas.coords(self.oval)):
        reward = 1
        done = True
    elif (s_ in [self.canvas.coords(self.hell1), self.canvas.coords(self.hell2)]):
        reward = (- 1)
        done = True
    else:
        reward = 0
        done = False
    return (s_, reward, done)
def step(self, action):
    s = self.canvas.coords(self.rect)
    base_action = np.array([0, 0])
    if (action == 0):
        if (s[1] > UNIT):
            base_action[1] -= UNIT
    elif (action == 1):
        if (s[1] < ((MAZE_H - 1) * UNIT)):
            base_action[1] += UNIT
    elif (action == 2):
        if (s[0] < ((MAZE_W - 1) * UNIT)):
            base_action[0] += UNIT
    elif (action == 3):
        if (s[0] > UNIT):
            base_action[0] -= UNIT
    self.canvas.move(self.rect, base_action[0], base_action[1])
    s_ = self.canvas.coords(self.rect)
    if (s_ == self.canvas.coords(self.oval)):
        reward = 1
        done = True
    elif (s_ in [self.canvas.coords(self.hell1), self.canvas.coords(self.hell2)]):
        reward = (- 1)
        done = True
    else:
        reward = 0
        done = False
    return (s_, reward, done)