Details
Output the possible moves for O
on a Reversi board.
In Reversi, X
and O
take turns placing tiles
on empty squares on the board. To determine if a move is legal, draw
a straight line in any direction (horizontal, vertical, or diagonal)
starting from the square. If the line intersects another friendly tile,
separated from the square by only opponent tiles, that square is a legal move.
For example, given:
...... .OXX!. ..X... ...!..
O
can only place on squares 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 may assume an odd number of tiles on the board.
Your program should output the board with each possible legal O
move
replaced with !
. Each output should be separated by a blank line.
External links: Wikipedia