Reversi
Details
Output the possible moves for O on a Reversi board.
In Reversi, you can only place a tile in a free spot such that there are one or more opponents tiles between the spot and a friendly tile in at least one direction. Directions are either horizontal, vertical, or diagonal.
For example, given:
..... .OXX! ..X.. ...!.
O
can only place on spots marked with !
.
Assume a board size of 8x8 and a position reachable on O
's turn,
from the following starting position:
........ ........ ........ ...OX... ...XO... ........ ........ ........
X
moves first so you can assume an odd number of tiles on the board.
Your program should output the board with valid position replaced with
!
. Each output should be separated by a blank line.