def addReward(self, r=None):
        """ A filtered mapping towards performAction of the underlying
            environment.
        """
        r = self.getReward() if r is None else r

        # by default, the cumulative reward is just the sum over the episode
        if self.discount:
            self.cumulativeReward += power(self.discount, self.samples) * r
        else:
            self.cumulativeReward += r
A filtered mapping towards performAction of the underlying
            environment.