<doocs>0289.Game of Life_1.py
def gameOfLife( board: List[List[int]]) -> None:
    m, n = len(board), len(board[0])
    dirs = [[-1, 0], [1, 0], [0, -1], [0, 1], [-1, -1], [-1, 1], [1, -1], [1, 1]]
    for i in range(m):
        for j in range(n):
            cnt = sum(
                1
                for a, b in dirs
                if 0 <= i + a < m
                and 0 <= j + b < n
                and board[i + a][j + b] in (1, 2)
            )
            if board[i][j] == 1 and (cnt < 2 or cnt > 3):
                board[i][j] = 2
            elif board[i][j] == 0 and (cnt == 3):
                board[i][j] = 3
    for i in range(m):
        for j in range(n):
            board[i][j] %= 2
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> None :
    var_5 , var_7 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_9 = [ [ - 1 , 0 ] , [ 1 , 0 ] , [ 0 , - 1 ] , [ 0 , 1 ] , [ - 1 , - 1 ] , [ - 1 , 1 ] , [ 1 , - 1 ] , [ 1 , 1 ] ]
    for var_11 in range ( var_5 ) :
        for var_12 in range ( var_7 ) :
            var_17 = sum ( 1 for var_16 , var_13 in var_9 if 0 <= var_11 + var_16 < var_5 and 0 <= var_12 + var_13 < var_7 and var_0 [ var_11 + var_16 ] [ var_12 + var_13 ] in ( 1 , 2 ) )
            if var_0 [ var_11 ] [ var_12 ] == 1 and ( var_17 < 2 or var_17 > 3 ) :
                var_0 [ var_11 ] [ var_12 ] = 2
            elif var_0 [ var_11 ] [ var_12 ] == 0 and ( var_17 == 3 ) :
                var_0 [ var_11 ] [ var_12 ] = 3
    for var_11 in range ( var_5 ) :
        for var_12 in range ( var_7 ) :
            var_0 [ var_11 ] [ var_12 ] %= 2
