This is a code-golf challenge: Given a specific board in the game of Othello (Reversi), find a move for Black that will capture the maximum number of White pieces.
(Obviously, this may not be the true "optimal" play for Black, but to keep things simple we are only interested in finding the move that will capture the most pieces.)
If you are unfamiliar with the rules of Othello (Reversi), you may refer to: http://en.wikipedia.org/wiki/Reversi
- Input will be provided as a file, or through stdin (your choice).
- You may assume that the board will be a standard 8x8 size.
- Black pieces will be indicated by
band White pieces will be indicated by
w. Empty spaces will be indicated by
- The input may not necessarily be a valid board reachable by the rules of the game. Regardless, you must still find the optimal move following the rules of the game.
- Your program must output the move by Black that will capture the most White pieces. If there is a tie, you may choose to output any (or all) of the moves. If there is no valid move, your program must indicate so by outputting
- Your output can be provided as a coordinate, such as
(3,4), or in algebraic notation, such as
b5. When submitting your answer, please clearly indicate your output format and specify where your coordinate system starts from.
........ ..b..... ...b.... ...wwww. ...wb... ........ ........ ........
Sample output in (row,col) format, with (0,0) in the top-left corner:
........ ......w. .wwwwww. .wwwwww. .wwwwww. .wwwwww. .b....b. ........
Sample output in algebraic notation, with a1 in the bottom-left corner:
........ ........ ..bbbb.. ..bwwb.. ..bwwb.. ..bbbb.. ........ ........
This is code golf, so the shortest solution will be accepted.