Updated reward function to cap out at max energy