code: def reward(self, action):
          
          r_reach, r_lift, r_stack = self.staged_rewards()
          if self.reward_shaping:
              reward = max(r_reach, r_lift, r_stack)
          else:
              reward = 1.0 if r_stack > 0 else 0.0
  
          return reward
docs: Reward function for the task.
  
          The dense reward has five components.
  
              Reaching: in [0, 1], to encourage the arm to reach the cube
              Grasping: in {0, 0.25}, non-zero if arm is grasping the cube
              Lifting: in {0, 1}, non-zero if arm has lifted the cube
              Aligning: in [0, 0.5], encourages aligning one cube over the other
              Stacking: in {0, 2}, non-zero if cube is stacked on other cube
  
          The sparse reward only consists of the stacking component.
          However, the sparse reward is either 0 or 1.
  
          Args:
              action (np array): unused for this task
  
          Returns:
              reward (float): the reward