-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
96 lines (91 loc) · 4.23 KB
/
main.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import re
import os
from events_base import EventsBase
from monsters_base import MonsterBase
from curses_base import CursesBase
from objects_base import ObjectsBase
from places_base import PlacesBase
from organizations_base import OrganizationsBase
from colors import Colors
def choose_option():
chosen_option = 1
print_values = ["print all monster names", "print all monsters with their attributes",
"print all clues of monsters", "find matching monster", "print monster data by name",
"print all curses names", "print all curses with their attributes",
"print all clues of curses", "find matching curse", "print curse data by name",
"print all objects names", "print all objects with their attributes",
"print all places names", "print all places with their attributes",
"print all events names", "print all events with their attributes",
"print all organizations names", "print all organizations with their attributes"]
while chosen_option != 0:
print(Colors.GREEN + Colors.BOLD + "\nChoose option: " + Colors.ENDC)
for option_number, print_value in zip(range(1, 19), print_values):
print(Colors.MAGENTA + str(option_number) + Colors.ENDC + " - " + print_value)
print(Colors.MAGENTA + "0" + Colors.ENDC + " - exit")
print(Colors.MAGENTA + "c" + Colors.ENDC + " - clear")
chosen_option_str = input()
chosen_option_str = re.sub('[a-bd-zA-Z,.&^%$#@?|/:;"_=]', '', chosen_option_str)
if chosen_option_str.isdigit():
chosen_option = int(chosen_option_str)
elif chosen_option_str == "c":
chosen_option = -2
else:
chosen_option = -1
if chosen_option == 1:
base_of_monsters.print_monsters_names()
elif chosen_option == 2:
base_of_monsters.print_all_monsters()
elif chosen_option == 3:
base_of_monsters.print_all_sorted_clues()
elif chosen_option == 4:
base_of_monsters.print_all_clues()
while not (chosen_clues := base_of_monsters.choose_clues()):
print("No clues chosen, try again...")
base_of_monsters.print_all_matches(chosen_clues)
elif chosen_option == 5:
name = input("Input monster name: ")
base_of_monsters.print_monster_data_by_name(name=name)
elif chosen_option == 6:
base_of_curses.print_curses_names()
elif chosen_option == 7:
base_of_curses.print_all_curses()
elif chosen_option == 8:
base_of_curses.print_all_sorted_clues()
elif chosen_option == 9:
base_of_curses.print_all_clues()
while not (chosen_clues := base_of_curses.choose_clues()):
print("No clues chosen, try again...")
base_of_curses.print_all_matches(chosen_clues)
elif chosen_option == 10:
name = input("Input curse name: ")
base_of_curses.print_curse_data_by_name(name=name)
elif chosen_option == 11:
base_of_objects.print_objects_names()
elif chosen_option == 12:
base_of_objects.print_all_objects()
elif chosen_option == 13:
base_of_places.print_places_names()
elif chosen_option == 14:
base_of_places.print_all_places()
elif chosen_option == 15:
base_of_events.print_events_names()
elif chosen_option == 16:
base_of_events.print_all_events()
elif chosen_option == 17:
base_of_organizations.print_organizations_names()
elif chosen_option == 18:
base_of_organizations.print_all_organizations()
elif chosen_option == 0:
print("Thank you for playing with this project!")
elif chosen_option == -2:
os.system('cls' if os.name == 'nt' else 'clear')
else:
print("Choose option from the list...")
if __name__ == "__main__":
base_of_monsters = MonsterBase()
base_of_curses = CursesBase()
base_of_objects = ObjectsBase()
base_of_places = PlacesBase()
base_of_events = EventsBase()
base_of_organizations = OrganizationsBase()
choose_option()