def execute_action(self, state, action):
        move = self.trans_mat[action]
        self.prev_state = state
        r = self.get_reward(self.prev_state, action)
        self.curr_state = min(max(self.curr_state + move, 0),self.num_states-1)
        if self.prev_state % self.dimensions[0] == 0 and self.curr_state % self.dimensions[0] == 14:
            self.curr_state -= 1
        if self.prev_state % self.dimensions[0] == 14 and self.curr_state % self.dimensions[0] == 0:
            self.curr_state += 1
        self.Q_mat[self.prev_state,action] = (
            self.Q_mat[self.prev_state,action]*(1-self.alpha) +
            (r + self.gamma*max(self.Q_mat[self.curr_state]))*self.alpha)
        if r == 10:
            return True
        return False
dataset/ETHPy150Open posborne/mlcollection/mlcollection/lib/reinforcement/simple_rl.py/Simple_RL.execute_action/original