""" Utility functions for tasks. """ def compute_score(total_reward: float, max_possible_reward: float) -> float: """ Normalize all rewards into score in range [0, 1]. """ if max_possible_reward <= 0: return 0.0 score = total_reward / max_possible_reward return min(max(score, 0.0), 1.0)