Example #1
0
 def category_picking(self):
     print(
         f'''Hello {self.username}, lets play a game. To start, you need to pick a category.''',
         end="\n\n")
     ll = SingleLinkedList()
     for i in self.game['categories'].keys():
         ll.insert_last(i)
     ll.print_list()
     print()
     self.category = input("Please pick a category: ")
     print()
     while True:
         if ll.find(self.category) is None:
             self.category = input(
                 "There is no such category. Please pick again: ")
             print()
         else:
             word_ll = SingleLinkedList()
             for i in self.list_of_categories[self.category]:
                 word_ll.insert_last(i)
             self.word = word_ll.pick_random()
             self.list_of_players[
                 self.username]["categories_picked"].append(
                     self.category.lower())
             self.list_of_players[self.username]["favorite_category"] = max(
                 set(self.list_of_players[self.username]
                     ["categories_picked"]),
                 key=self.list_of_players[
                     self.username]["categories_picked"].count)
             break
Example #2
0
 def information_getting(self):
     info = input(
         "If you want to know your statistics, insert info, otherwise GAME OVER: "
     )
     print()
     if info.lower() == "info":
         print()
         print(f"* {self.ranking()} * {self.username}")
         ll = SingleLinkedList()
         for key, value in self.game["players"][self.username].items():
             if type(value) != list:
                 ll.insert_last(f"{key}: {value}")
         ll.print_list()
         print()
     print("Thanks for playing. See you next time!")
     exit()