| 401 | |
| 402 | print("Example 25") |
| 403 | async def report_outcome(self, number): # Changed |
| 404 | new_distance = math.fabs(number - self.secret) |
| 405 | |
| 406 | if new_distance == 0: |
| 407 | decision = CORRECT |
| 408 | elif self.last_distance is None: |
| 409 | decision = UNSURE |
| 410 | elif new_distance < self.last_distance: |
| 411 | decision = WARMER |
| 412 | elif new_distance > self.last_distance: |
| 413 | decision = COLDER |
| 414 | else: |
| 415 | decision = SAME |
| 416 | |
| 417 | self.last_distance = new_distance |
| 418 | |
| 419 | await self.send(f"REPORT {decision}") # Changed |
| 420 | return decision |
| 421 | |
| 422 | |
| 423 | print("Example 26") |