當前位置: 首頁>>代碼示例>>Python>>正文


Python Board.san方法代碼示例

本文整理匯總了Python中chess.Board.san方法的典型用法代碼示例。如果您正苦於以下問題:Python Board.san方法的具體用法?Python Board.san怎麽用?Python Board.san使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在chess.Board的用法示例。


在下文中一共展示了Board.san方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, move, fen, side, beep=False, left_dots=0, right_dots=0):
     bit_board = Board(fen)
     move_text = bit_board.san(move)
     if side == ClockSide.RIGHT:
         move_text = move_text.rjust(11)
     text = self.dgttranslate.move(move_text)
     self._display_on_dgt_pi(text, beep, left_dots, right_dots)
開發者ID:lucasvdp,項目名稱:picochess,代碼行數:9,代碼來源:dgtpi.py

示例2: pv_to_san

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def pv_to_san(self):
     if(self.san_arr == None):
         return ""
     else:
         try:
             pv_san = []
             board = Board(self.san_arr[0])
             moves = self.san_arr[1]
             for uci in moves:
                 move = Move.from_uci(uci)
                 if(move in board.pseudo_legal_moves):
                     pv_san.append(board.san(move))
                     board.push(move)
             if(len(pv_san) > 0):
                 s = ""
                 white_moves = True
                 move_no = (self.no_game_halfmoves//2)+1
                 if(self.no_game_halfmoves % 2 == 1):
                     white_moves = False
                     s += str(move_no)+". ... "
                     move_no += 1
                 for san in pv_san:
                     if(white_moves):
                         s += " "+str(move_no)+". "+san
                         move_no +=1
                     else:
                         s += " "+san
                     white_moves = not white_moves
                 return s
             else:
                 return ""
         except ValueError:
             return ""
開發者ID:jasiegel4,項目名稱:jerry,代碼行數:35,代碼來源:engine_info.py

示例3: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, move, fen, beep=False):
     if self.enable_dgt_3000:
         bit_board = Board(fen)
         text = self.dgttranslate.move(bit_board.san(move))
         self._display_on_dgt_3000(text, beep)
     else:
         text = ' ' + move.uci()
         self._display_on_dgt_xl(text, beep)
開發者ID:pablo2000,項目名稱:picochess,代碼行數:10,代碼來源:dgthw.py

示例4: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, move, fen, beep=BeepLevel.CONFIG):
     beep = self.get_beep_level(beep)
     if self.enable_dgt_3000:
         bit_board = Board(fen)
         text = bit_board.san(move)
         self._display_on_dgt_3000(text, beep)
     else:
         text = ' ' + move.uci()
         self._display_on_dgt_xl(text, beep)
開發者ID:aekker,項目名稱:picochess,代碼行數:11,代碼來源:dgthw.py

示例5: visit_move

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
    def visit_move(self, board: chess.Board, move: chess.Move) -> None:
        if self.variations or not self.variation_depth:
            # Write the move number.
            if board.turn == chess.WHITE:
                self.write_token(str(board.fullmove_number) + ". ")
            elif self.force_movenumber:
                self.write_token(str(board.fullmove_number) + "... ")

            # Write the SAN.
            self.write_token(board.san(move) + " ")

            self.force_movenumber = False
開發者ID:niklasf,項目名稱:python-chess,代碼行數:14,代碼來源:pgn.py

示例6: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, move, fen, side, beep=False, left_dots=0, right_dots=0):
     if self.enable_dgt_3000:
         bit_board = Board(fen)
         move_text = bit_board.san(move)
         if side == ClockSide.RIGHT:
             move_text = move_text.rjust(8)
         text = self.dgttranslate.move(move_text)
         self._display_on_dgt_3000(text, beep, left_dots, right_dots)
     else:
         move_text = move.uci()
         if side == ClockSide.RIGHT:
             move_text = move_text.rjust(6)
         self._display_on_dgt_xl(move_text, beep, left_dots, right_dots)
開發者ID:lucasvdp,項目名稱:picochess,代碼行數:15,代碼來源:dgthw.py

示例7: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, message):
     left_dots = message.ld if hasattr(message, 'ld') else ClockDots.NONE
     right_dots = message.rd if hasattr(message, 'rd') else ClockDots.NONE
     display_m = self.enable_dgt_3000 and not self.dgtserial.enable_revelation_leds
     if display_m:
         bit_board = Board(message.fen)
         move_text = bit_board.san(message.move)
         if message.side == ClockSide.RIGHT:
             move_text = move_text.rjust(8)
         text = self.dgttranslate.move(move_text)
         self._display_on_dgt_3000(text, message.beep, left_dots, right_dots)
     else:
         move_text = message.move.uci()
         if message.side == ClockSide.RIGHT:
             move_text = move_text.rjust(6)
         self._display_on_dgt_xl(move_text, message.beep, left_dots, right_dots)
開發者ID:Ernisius,項目名稱:picochess,代碼行數:18,代碼來源:dgthw.py

示例8: get_san

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
    def get_san(self, message, is_xl=False):
        """Create a chess.board plus a text ready to display on clock."""

        def move(text: str, language: str, capital: bool, short: bool):
            """Return move text for clock display."""
            if short:
                directory = {}
                if language == 'de':
                    directory = {'R': 'T', 'N': 'S', 'B': 'L', 'Q': 'D'}
                if language == 'nl':
                    directory = {'R': 'T', 'N': 'P', 'B': 'L', 'Q': 'D'}
                if language == 'fr':
                    directory = {'R': 'T', 'N': 'C', 'B': 'F', 'Q': 'D', 'K': '@'}
                if language == 'es':
                    directory = {'R': 'T', 'N': 'C', 'B': 'A', 'Q': 'D', 'K': '@'}
                if language == 'it':
                    directory = {'R': 'T', 'N': 'C', 'B': 'A', 'Q': 'D', 'K': '@'}
                for i, j in directory.items():
                    text = text.replace(i, j)
                text = text.replace('@', 'R')  # replace the King "@" from fr, es, it languages
            if capital:
                return text.upper()
            else:
                return text

        bit_board = Board(message.fen, chess960=message.uci960)
        if bit_board.is_legal(message.move):
            if message.long:
                move_text = message.move.uci()
            else:
                move_text = bit_board.san(message.move)
        else:
            logging.warning('[%s] illegal move %s found - uci960: %s fen: %s', self.get_name(), message.move,
                            message.uci960, message.fen)
            move_text = 'er{}' if is_xl else 'err {}'
            move_text = move_text.format(message.move.uci()[:4])

        if message.side == ClockSide.RIGHT:
            move_text = move_text.rjust(6 if is_xl else 8)
        return bit_board, move(move_text, message.lang, message.capital and not is_xl, not message.long)
開發者ID:djdekker,項目名稱:picochess,代碼行數:42,代碼來源:iface.py

示例9: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, move, fen, beep=BeepLevel.CONFIG):
     beep = self.get_beep_level(beep)
     bit_board = Board(fen)
     text = bit_board.san(move)
     self._display_on_dgt_pi(text, beep)
開發者ID:acmtd,項目名稱:picochess,代碼行數:7,代碼來源:dgtpi.py

示例10: display_move_on_clock

# 需要導入模塊: from chess import Board [as 別名]
# 或者: from chess.Board import san [as 別名]
 def display_move_on_clock(self, move, fen, beep=False):
     bit_board = Board(fen)
     text = self.dgttranslate.move(bit_board.san(move))
     self._display_on_dgt_pi(text, beep)
開發者ID:pablo2000,項目名稱:picochess,代碼行數:6,代碼來源:dgtpi.py


注:本文中的chess.Board.san方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。