Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = []
- a = [[1 for j in range(8)] for i in range(8)]
- for i in range(8):
- s.append(input())
- for i in range(8):
- for j in range(8):
- if s[i][j] == 'B':
- a[i][j] = 0
- x = i - 1
- y = j - 1
- while x >= 0 and y >= 0 and s[x][y] == '*':
- a[x][y] = 0
- x -= 1
- y -= 1
- x = i - 1
- y = j + 1
- while x >= 0 and y < 8 and s[x][y] == '*':
- a[x][y] = 0
- x -= 1
- y += 1
- x = i + 1
- y = j + 1
- while x < 8 and y < 8 and s[x][y] == '*':
- a[x][y] = 0
- x += 1
- y += 1
- x = i + 1
- y = j - 1
- while x < 8 and y >= 0 and s[x][y] == '*':
- a[x][y] = 0
- x += 1
- y -= 1
- if s[i][j] == 'R':
- a[i][j] = 0
- x = i - 1
- while x >= 0 and s[x][j] == '*':
- a[x][j] = 0
- x -= 1
- x = i + 1
- while x < 8 and s[x][j] == '*':
- a[x][j] = 0
- x += 1
- y = j - 1
- while y >= 0 and s[i][y] == '*':
- a[i][y] = 0
- y -= 1
- y = j + 1
- while y < 8 and s[i][y] == '*':
- a[i][y] = 0
- y += 1
- ans = 0
- for i in range(8):
- ans += sum(a[i])
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement