engine.py
def UCI_move_format_string(self):
        """Return the move in the UCI move format. For example like:
        "e2e4", "e7e5", "e1g1" (white short castling), "e7e8q" (for promotion),
        "c5b6" (en passant).
        """
        if len(self.change_list) == 2:
            # The position where the move starts is not empty before the change.
            if self.change_list[0][1] != None:
                from_triple = self.change_list[0]
                to_triple = self.change_list[1]
            else:
                from_triple = self.change_list[1]
                to_triple = self.change_list[0]

            from_position = convert_position_to_conventional_format(from_triple[0])
            to_position = convert_position_to_conventional_format(to_triple[0])
            from_piece = from_triple[1].name
            to_piece = to_triple[2].name

            # If promotion.
            if from_piece != to_piece:
                if to_piece == "Q" or to_piece == "q":
                    return from_position + to_position + "q"
                if to_piece == "R" or to_piece == "r":
                    return from_position + to_position + "r"
                if to_piece == "B" or to_piece == "b":
                    return from_position + to_position + "b"
                if to_piece == "N" or to_piece == "n":
                    return from_position + to_position + "n"
            else:
                return from_position + to_position

        # En passants.
        if len(self.change_list) == 3:
            positions = [convert_position_to_conventional_format(p) 
                         for (p, vb, va) in self.change_list]
            # The from position has a unique file.
            files = [p[0] for p in positions]
            for p in positions:
                if files.count(p[0]) == 1:
                    from_position = p
                    break

            # The to position has a unique row.
            rows = [p[1] for p in positions]
            for p in positions:
                if rows.count(p[1]) == 1:
                    to_position = p
                    break

            return from_position + to_position

        # Castlings
        if len(self.change_list) == 4:
            positions = [p for (p, vb, va) in self.change_list]
            if 0 in positions:
                return "e1c1"
            if 7 in positions:
                return "e1g1"
            if 56 in positions:
                return "e8c8"
            if 63 in positions:
                return "e8g8"
Return the move in the UCI move format. For example like:
        "e2e4", "e7e5", "e1g1" (white short castling), "e7e8q" (for promotion),
        "c5b6" (en passant).
        
Return the move in the UCI move format.
Return the move in the UCI move format .
def UCI_move_format_string(self):
        if len(self.change_list) == 2:
            if self.change_list[0][1] != None:
                from_triple = self.change_list[0]
                to_triple = self.change_list[1]
            else:
                from_triple = self.change_list[1]
                to_triple = self.change_list[0]
            from_position = convert_position_to_conventional_format(from_triple[0])
            to_position = convert_position_to_conventional_format(to_triple[0])
            from_piece = from_triple[1].name
            to_piece = to_triple[2].name
            if from_piece != to_piece:
                if to_piece == "Q" or to_piece == "q":
                    return from_position + to_position + "q"
                if to_piece == "R" or to_piece == "r":
                    return from_position + to_position + "r"
                if to_piece == "B" or to_piece == "b":
                    return from_position + to_position + "b"
                if to_piece == "N" or to_piece == "n":
                    return from_position + to_position + "n"
            else:
                return from_position + to_position
        if len(self.change_list) == 3:
            positions = [convert_position_to_conventional_format(p) 
                         for (p, vb, va) in self.change_list]
            files = [p[0] for p in positions]
            for p in positions:
                if files.count(p[0]) == 1:
                    from_position = p
                    break
            rows = [p[1] for p in positions]
            for p in positions:
                if rows.count(p[1]) == 1:
                    to_position = p
                    break
            return from_position + to_position
        if len(self.change_list) == 4:
            positions = [p for (p, vb, va) in self.change_list]
            if 0 in positions:
                return "e1c1"
            if 7 in positions:
                return "e1g1"
            if 56 in positions:
                return "e8c8"
            if 63 in positions:
                return "e8g8"
def UCI_move_format_string ( self ) : if len ( self . change_list ) == 2 : if self . change_list [ 0 ] [ 1 ] != None : from_triple = self . change_list [ 0 ] to_triple = self . change_list [ 1 ] else : from_triple = self . change_list [ 1 ] to_triple = self . change_list [ 0 ] from_position = convert_position_to_conventional_format ( from_triple [ 0 ] ) to_position = convert_position_to_conventional_format ( to_triple [ 0 ] ) from_piece = from_triple [ 1 ] . name to_piece = to_triple [ 2 ] . name if from_piece != to_piece : if to_piece == "Q" or to_piece == "q" : return from_position + to_position + "q" if to_piece == "R" or to_piece == "r" : return from_position + to_position + "r" if to_piece == "B" or to_piece == "b" : return from_position + to_position + "b" if to_piece == "N" or to_piece == "n" : return from_position + to_position + "n" else : return from_position + to_position if len ( self . change_list ) == 3 : positions = [ convert_position_to_conventional_format ( p ) for ( p , vb , va ) in self . change_list ] files = [ p [ 0 ] for p in positions ] for p in positions : if files . count ( p [ 0 ] ) == 1 : from_position = p break rows = [ p [ 1 ] for p in positions ] for p in positions : if rows . count ( p [ 1 ] ) == 1 : to_position = p break return from_position + to_position if len ( self . change_list ) == 4 : positions = [ p for ( p , vb , va ) in self . change_list ] if 0 in positions : return "e1c1" if 7 in positions : return "e1g1" if 56 in positions : return "e8c8" if 63 in positions : return "e8g8"
Return the move in the UCI move format.
Return the move in the UCI move format .
"""Return the move in the UCI move format. For example like:
        "e2e4", "e7e5", "e1g1" (white short castling), "e7e8q" (for promotion),
        "c5b6" (en passant).
        """ # The position where the move starts is not empty before the change. # If promotion. # En passants. # The from position has a unique file. # The to position has a unique row. # Castlings
self