Carlettos

paitonga

Sep 1st, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. uwu = np.random.randint(2, size=(100,100))
  2. patron = [[1,1,0],[1,0,1],[1,1,0],[1,0,1],[1,1,0]]
  3.  
  4. def match(lista):
  5.     return np.array_equal(lista, patron)
  6.  
  7. veces = 0
  8. for i in range(len(uwu)-5):
  9.     for j in range(len(uwu)-3):
  10.         if match(uwu[i:i+5,j:j+3]):
  11.             # print(uwu[i:i+5,j:j+3])
  12.             veces += 1
  13. print(veces)
Advertisement
Add Comment
Please, Sign In to add comment