当前位置: 首页>>代码示例>>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;未经允许,请勿转载。