(self, action)
return state, float(done), done, None
The agent can perform one of four actions,
        up, down, left or right, which have a stochastic effect. With probability 2/3, the actions
        cause the agent to move one cell in the corresponding direction, and with probability 1/3,
        the agent moves instead in one of the other three directions, each with 1/9 probability. In
        either case, if the movement would take the agent into a wall then the agent remains in the
        same cell.

        We consider a case in which rewards are zero on all state transitions.
The agent can perform one of four actions,
        up, down, left or right, which have a stochastic effect. With probability 2/3, the actions
        cause the agent to move one cell in the corresponding direction, and with probability 1/3,
        the agent moves instead in one of the other three directions, each with 1/9 probability. In
        either case, if the movement would take the agent into a wall then the agent remains in the
        same cell.
The agent can perform one of four actions up down left or right which have a stochastic effect . With probability 2 / 3 the actions cause the agent to move one cell in the corresponding direction and with probability 1 / 3 the agent moves instead in one of the other three directions each with 1 / 9 probability . In either case if the movement would take the agent into a wall then the agent remains in the same cell .
def step(self, action):
        """
        The agent can perform one of four actions,
        up, down, left or right, which have a stochastic effect. With probability 2/3, the actions
        cause the agent to move one cell in the corresponding direction, and with probability 1/3,
        the agent moves instead in one of the other three directions, each with 1/9 probability. In
        either case, if the movement would take the agent into a wall then the agent remains in the
        same cell.

        We consider a case in which rewards are zero on all state transitions.
        """
        nextcell = tuple(self.currentcell + self.directions[action])
        if not self.occupancy[nextcell]:
            self.currentcell = nextcell
            if self.rng.uniform() < 1/3.:
                empty_cells = self.empty_around(self.currentcell)
                self.currentcell = empty_cells[self.rng.randint(len(empty_cells))]

        state = self.tostate[self.currentcell]
        done = state == self.goal
        return state, float(done), done, None
def step ( self , action ) : nextcell = tuple ( self . currentcell + self . directions [ action ] ) if not self . occupancy [ nextcell ] : self . currentcell = nextcell if self . rng . uniform ( ) < 1 / 3. : empty_cells = self . empty_around ( self . currentcell ) self . currentcell = empty_cells [ self . rng . randint ( len ( empty_cells ) ) ] state = self . tostate [ self . currentcell ] done = state == self . goal return state , float ( done ) , done , None