Spaces:
Paused
Paused
File size: 1,019 Bytes
10de6b6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # pylint: skip-file
import asyncio
import akinator
aki = akinator.Akinator()
async def play():
await aki.start_game()
while not aki.finished:
print(f"\nQuestion: {str(aki)}")
user_input = input(
"Your answer ([y]es/[n]o/[i] don't know/[p]robably/[pn] probably not, [b]ack): "
).strip().lower()
if user_input == "b":
try:
await aki.back()
except akinator.CantGoBackAnyFurther:
print("You can't go back any further!")
else:
try:
await aki.answer(user_input)
except akinator.InvalidChoiceError:
print("Invalid answer. Please try again.")
print("\n--- Game Over ---")
print(f"Proposition: {aki.name_proposition}")
print(f"Description: {aki.description_proposition}")
print(f"Pseudo: {aki.pseudo}")
print(f"Photo: {aki.photo}")
print(f"Final Message: {aki.question}")
asyncio.run(play())
|