List-less
This commit is contained in:
parent
519613e138
commit
878b83966d
|
@ -3,15 +3,14 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
a = np.array([list(map(int,i)) for i in [list(j) for j in open("08/i").read().strip().split("\n")]])
|
a = np.array([list(map(int,i)) for i in [list(j) for j in open("08/i").read().strip().split("\n")]])
|
||||||
visible = np.shape(a)[0]*2+(np.shape(a)[1]-2)*2
|
visible = np.shape(a)[0]*2+(np.shape(a)[1]-2)*2
|
||||||
print(visible)
|
|
||||||
|
|
||||||
for y in range(1,np.shape(a)[0]-1):
|
for y in range(1,np.shape(a)[0]-1):
|
||||||
for x in range(1,np.shape(a)[1]-1):
|
for x in range(1,np.shape(a)[1]-1):
|
||||||
# Visible?
|
# Visible?
|
||||||
left = True if len(list(np.where(a[y][0:x]>=a[y][x])[0]))<1 else False
|
left = True if np.where(a[y][0:x]>=a[y][x])[0].size<1 else False
|
||||||
right = True if len(list(np.where(a[y][x:] >=a[y][x])[0][1:]))<1 else False
|
right = True if np.where(a[y][x:] >=a[y][x])[0][1:].size<1 else False
|
||||||
aktiv = True if len(list(np.where(a[:,x][0:y]>=a[y,x])[0]))<1 else False
|
aktiv = True if np.where(a[:,x][0:y]>=a[y,x])[0].size<1 else False
|
||||||
passiv = True if len(list(np.where(a[:,x][y:]>=a[y,x])[0][1:]))<1 else False
|
passiv =True if np.where(a[:,x][y:]>=a[y,x])[0][1:].size<1 else False
|
||||||
|
|
||||||
if left or right or aktiv or passiv:
|
if left or right or aktiv or passiv:
|
||||||
visible+=1
|
visible+=1
|
||||||
|
|
Loading…
Reference in a new issue