Esempio n. 1
0
    def get_console_repr_of_board(self, board_object):
        """
                UILinuxConsole.get_console_repr_of_board()

                Return a string representing the Board object "board_object".
        """
        return board_txtrepr.get_board_textrepr(board_object=board_object,
                                                add_ansi_colors=self.use_ansi_colors_on_console,
                                                console_symbols_for_players=self.console_symbols_for_players,
                                                console_colors_for_players=self.console_colors_for_players)
Esempio n. 2
0
    def write_a_board(self, board_object):
        """
                GameBackupFile.write_a_board()

                Write the board <board_object> in the backup file.
        """
        if CONFIGPARSER["game.backup file"]["add comments"] != "True":
            return

        symbs = CONFIGPARSER["game.backup file"]["console symbols for players"]
        self.srcfile.write(GameBackupFile.COMMENT_PREFIX + \
                           get_board_textrepr(board_object=board_object,
                                              add_ansi_colors=False,
                                              console_symbols_for_players=symbs,
                                              console_colors_for_players=None,
                                              startstring=GameBackupFile.COMMENT_PREFIX) + \
                           "\n")

        self.flush() # since it's a backupfile, we force the writing.