In this problem we consider the simplified version of game Reversi.
The simple Reversi is a strategy board game played on an 8x8 board. There are 64 identical disks, which are light on one side and dark on the other.
Given an initial play and a sequence of moves, your job is to output the final play.
The rules are the following:
1. Dark and light play in turns.
2. When a disk is placed and is faced up light(resp. dark), all of the dark(resp. light) disks between light disks are then turned over to become dark(resp. light).
3. ‘L’(resp. ‘D’) is shown when the disk is faced up light(resp. dark). The ‘-‘ is shown when there is no disk on the position.
Note that every move of the testcases is a valid move, that is, the following two conditions will not happen:
1. A disk is placed on a disk.
2. The disk placed did not turn over some disks.
You may use the following piece of code:
#include#define B_SIZE 8 char board[B_SIZE][B_SIZE]; void read_board(){ int i, j; for(i = 0; i < B_SIZE; i++){ for(j = 0; j < B_SIZE; j++){ scanf(" %c", &board[i][j]); } } } void print_board(){ int i, j; for(i = 0; i < B_SIZE; i++){ for(j = 0; j < B_SIZE; j++){ printf(" %c", board[i][j]); } printf("\n"); } } int main() { int N; read_board(); scanf("%d", &N); /* your code here */ print_board(); printf("%d\n", N); return 0; }
The map
N moves
(dark/light row column) of move 1
(dark/light row column) of move 2
…
(dark/light row column) of move N
The final map.
Each entry of the map is printed by ‘ %c’, and there is a newline character at the end of the map.