File size: 853 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
# pylint: skip-file

import akinator

aki = akinator.Akinator()
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:
            aki.back()
        except akinator.CantGoBackAnyFurther:
            print("You can't go back any further!")
    else:
        try:
            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}")