Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,6 +69,14 @@ def animal_battle(animal1: str, animal2: str) -> str:
|
|
| 69 |
if has_habitat_advantage(animal2, animal1):
|
| 70 |
score2 *= 1.2
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
# Determine winner and create detailed response
|
| 73 |
if abs(score1 - score2) < 2:
|
| 74 |
return f"It would be a close battle between the {animal1} and {animal2}! Both have their advantages: " \
|
|
|
|
| 69 |
if has_habitat_advantage(animal2, animal1):
|
| 70 |
score2 *= 1.2
|
| 71 |
|
| 72 |
+
# Special case for extreme size differences
|
| 73 |
+
size_difference = abs(animal_stats[animal1]["size"] - animal_stats[animal2]["size"])
|
| 74 |
+
if size_difference > 5:
|
| 75 |
+
bigger_animal = animal1 if animal_stats[animal1]["size"] > animal_stats[animal2]["size"] else animal2
|
| 76 |
+
smaller_animal = animal2 if bigger_animal == animal1 else animal1
|
| 77 |
+
return f"The {bigger_animal} would win against the {smaller_animal}! The size difference is too great - " \
|
| 78 |
+
f"the {bigger_animal}'s sheer mass and strength would overwhelm the {smaller_animal}."
|
| 79 |
+
|
| 80 |
# Determine winner and create detailed response
|
| 81 |
if abs(score1 - score2) < 2:
|
| 82 |
return f"It would be a close battle between the {animal1} and {animal2}! Both have their advantages: " \
|