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.
0 bytes, 0 chars
Restore solutionCompiled from
AT&T syntax to x86-64 Linux. Use
syscalls to write output.
Fennel is an experimental language, no solutions will be saved.
Please leave feedback on the
GitHub issue.
ctrl + enter or