Example #1
0
 def __print_res(self, is_human_win: bool = True):
     if is_human_win:
         self.__print_line(color="light-green")
         s = colorized(
             "**" + str.center("Вы выиграли !!!", self.__koeff - 4) + "**",
             "light-green")
         print(s)  # color = 46 - ярко-зелёный
         self.__print_line(color="light-green")
     else:
         self.__print_line(color="red")
         s = colorized(
             "**" + str.center("Вы проиграли...", self.__koeff - 4) + "**",
             "red")
         print(s)
         self.__print_line(color="red")
Example #2
0
 def __prep_print(self, s):
     s = s.replace(
         cell_state["FREE_CELL"]["value"],
         colorized(cell_state["FREE_CELL"]["symbol"],
                   cell_state["FREE_CELL"]["color"]))
     s = s.replace(
         cell_state["USED_CELL"]["value"],
         colorized(cell_state["USED_CELL"]["symbol"],
                   cell_state["USED_CELL"]["color"]))
     s = s.replace(
         cell_state["ALIVE_DECK"]["value"],
         colorized(cell_state["ALIVE_DECK"]["symbol"],
                   cell_state["ALIVE_DECK"]["color"]))
     s = s.replace(
         cell_state["SHOOTED_DECK"]["value"],
         colorized(cell_state["SHOOTED_DECK"]["symbol"],
                   cell_state["SHOOTED_DECK"]["color"]))
     return s
Example #3
0
 def __str__(self):
     return colorized(self.message, "red")
Example #4
0
 def __print_line(self, s: str = "*", color=None):
     if color is None:
         print(s * self.__koeff)
     else:
         print(colorized(s * self.__koeff, color))
Example #5
0
 def __str__(self):
     return colorized("Ошибка! В эту клетку уже стреляли!", "red")