<doocs>0688.Knight Probability in Chessboard_1.py
def knightProbability( n: int, k: int, row: int, column: int) -> float:
    dp = [[[0] * n for _ in range(n)] for _ in range(k + 1)]
    for l in range(k + 1):
        for i in range(n):
            for j in range(n):
                if l == 0:
                    dp[l][i][j] = 1
                else:
                    for a, b in (
                        (-2, -1),
                        (-2, 1),
                        (2, -1),
                        (2, 1),
                        (-1, -2),
                        (-1, 2),
                        (1, -2),
                        (1, 2),
                    ):
                        x, y = i + a, j + b
                        if 0 <= x < n and 0 <= y < n:
                            dp[l][i][j] += dp[l - 1][x][y] / 8
    return dp[k][row][column]
def sample_funcname ( var_0 : int , var_2 : int , var_3 : int , var_4 : int ) -> float :
    var_10 = [ [ [ 0 ] * var_0 for var_7 in range ( var_0 ) ] for var_7 in range ( var_2 + 1 ) ]
    for var_11 in range ( var_2 + 1 ) :
        for var_12 in range ( var_0 ) :
            for var_13 in range ( var_0 ) :
                if var_11 == 0 :
                    var_10 [ var_11 ] [ var_12 ] [ var_13 ] = 1
                else :
                    for var_15 , var_16 in ( ( - 2 , - 1 ) , ( - 2 , 1 ) , ( 2 , - 1 ) , ( 2 , 1 ) , ( - 1 , - 2 ) , ( - 1 , 2 ) , ( 1 , - 2 ) , ( 1 , 2 ) , ) :
                        var_17 , var_18 = var_12 + var_15 , var_13 + var_16
                        if 0 <= var_17 < var_0 and 0 <= var_18 < var_0 :
                            var_10 [ var_11 ] [ var_12 ] [ var_13 ] += var_10 [ var_11 - 1 ] [ var_17 ] [ var_18 ] / 8
    return var_10 [ var_2 ] [ var_3 ] [ var_4 ]
