<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reward_goal(self):
 """ Add an end goal reward """

        if not 'goal' in self.mode:
            return
        mode = self.mode['goal']
        if mode and mode['reward'] and self.__test_cond(mode):
            if mode['reward'] > 0:
                self.logger.info("Escaped!!")
            self.player.stats['reward'] += mode['reward']
            self.player.stats['score'] += mode['reward']

            self.player.game_over = self.player.game_over or mode['terminal']