comefrom: <garvit244>999_1.py
code: def numRookCaptures( board):
      result = 0
      rook_index = (0, 0)
      for row in range(len(board)):
          for col in range(len(board[0])):
              if board[row][col] == 'R':
                  rook_index = (row, col)
                  break
             
      flag = True
      col = rook_index[1]-1
      pawn = 0
      while col >= 0:
          if board[rook_index[0]][col] == 'B':
              flag = False
              break
          if board[rook_index[0]][col] == 'p':
              pawn += 1
              break
          col -= 1
      if flag and pawn != 0:
          result += 1
          
      flag = True
      col = rook_index[1]+1
      pawn = 0
      while col < len(board[0]):
          if board[rook_index[0]][col] == 'B':
              flag = False
              break
          if board[rook_index[0]][col] == 'p':
              pawn += 1
              break
          col += 1
          
      if flag and pawn != 0:
          result += 1
      
      flag = True
      row = rook_index[0]+1
      pawn = 0
      while row < len(board):
          if board[row][rook_index[1]] == 'B':
              flag = False
              break
              
          if board[row][rook_index[1]] == 'p':
              pawn += 1
              break
          row += 1
          
      if flag and pawn != 0:
          result += 1
          
      pawn = 0
      flag = True
      row = rook_index[0]-1
      while row >= 0:
          if board[row][rook_index[1]] == 'B':
              flag = False
              break
          if board[row][rook_index[1]] == 'p':
              pawn += 1
              break
          row -= 1
      if flag and pawn != 0:
          result += 1
      
      return result
masked: def sample_funcname ( var_0 ) :
      var_2 = 0
      var_3 = ( 0 , 0 )
      for var_6 in range ( len ( var_0 ) ) :
          for var_7 in range ( len ( var_0 [ 0 ] ) ) :
              if var_0 [ var_6 ] [ var_7 ] == 'R' :
                  var_3 = ( var_6 , var_7 )
                  break
      var_10 = True
      var_7 = var_3 [ 1 ] - 1
      var_12 = 0
      while var_7 >= 0 :
          if var_0 [ var_3 [ 0 ] ] [ var_7 ] == 'B' :
              var_10 = False
              break
          if var_0 [ var_3 [ 0 ] ] [ var_7 ] == 'p' :
              var_12 += 1
              break
          var_7 -= 1
      if var_10 and var_12 != 0 :
          var_2 += 1
      var_10 = True
      var_7 = var_3 [ 1 ] + 1
      var_12 = 0
      while var_7 < len ( var_0 [ 0 ] ) :
          if var_0 [ var_3 [ 0 ] ] [ var_7 ] == 'B' :
              var_10 = False
              break
          if var_0 [ var_3 [ 0 ] ] [ var_7 ] == 'p' :
              var_12 += 1
              break
          var_7 += 1
      if var_10 and var_12 != 0 :
          var_2 += 1
      var_10 = True
      var_6 = var_3 [ 0 ] + 1
      var_12 = 0
      while var_6 < len ( var_0 ) :
          if var_0 [ var_6 ] [ var_3 [ 1 ] ] == 'B' :
              var_10 = False
              break
          if var_0 [ var_6 ] [ var_3 [ 1 ] ] == 'p' :
              var_12 += 1
              break
          var_6 += 1
      if var_10 and var_12 != 0 :
          var_2 += 1
      var_12 = 0
      var_10 = True
      var_6 = var_3 [ 0 ] - 1
      while var_6 >= 0 :
          if var_0 [ var_6 ] [ var_3 [ 1 ] ] == 'B' :
              var_10 = False
              break
          if var_0 [ var_6 ] [ var_3 [ 1 ] ] == 'p' :
              var_12 += 1
              break
          var_6 -= 1
      if var_10 and var_12 != 0 :
          var_2 += 1
      return var_2
  