comefrom: <doocs>0999.Available Captures for Rook_1.py
code: def numRookCaptures( board: List[List[str]]) -> int:
      x, y, n = 0, 0, 8
      for i in range(n):
          for j in range(n):
              if board[i][j] == 'R':
                  x, y = i, j
                  break
      ans = 0
      for a, b in [[0, -1], [0, 1], [-1, 0], [1, 0]]:
          i, j = x, y
          while 0 <= i + a < n and 0 <= j + b < n and board[i + a][j + b] != 'B':
              i, j = i + a, j + b
              if board[i][j] == 'p':
                  ans += 1
                  break
      return ans
masked: def sample_funcname ( var_0 : List [ List [ str ] ] ) -> int :
      var_5 , var_6 , var_8 = 0 , 0 , 8
      for var_10 in range ( var_8 ) :
          for var_11 in range ( var_8 ) :
              if var_0 [ var_10 ] [ var_11 ] == 'R' :
                  var_5 , var_6 = var_10 , var_11
                  break
      var_13 = 0
      for var_15 , var_16 in [ [ 0 , - 1 ] , [ 0 , 1 ] , [ - 1 , 0 ] , [ 1 , 0 ] ] :
          var_10 , var_11 = var_5 , var_6
          while 0 <= var_10 + var_15 < var_8 and 0 <= var_11 + var_16 < var_8 and var_0 [ var_10 + var_15 ] [ var_11 + var_16 ] != 'B' :
              var_10 , var_11 = var_10 + var_15 , var_11 + var_16
              if var_0 [ var_10 ] [ var_11 ] == 'p' :
                  var_13 += 1
                  break
      return var_13
  