Today marks the 15th anniversary of Garry Kasparov's defeat against Deep Blue. Speaking of chess...
Input is a string that represents an 8x8 chess board containing only empty squares (.
) and queens (Q
). Output the number of squares that any queen can move to the next move. Queens can move any number of squares vertically, horizontally or diagonally.
Write either a program or a function. Shortest code wins, but most inventive solution gets the most upvotes.
Examples
Input:
Q.......
........
.Q......
........
........
........
........
........
Output:
37
Input:
QQQQQQQQ
QQQQQQQQ
QQQQQQQQ
QQQQ.QQQ
QQQQQQQQ
QQQQQQQQ
QQQQQQQQ
QQQQQQQQ
Output:
1