SJSU Weekly Practice Problems 12/26

Start

2021-12-26 20:00 AKST

SJSU Weekly Practice Problems 12/26

End

2022-01-02 20:00 AKST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -145 days 6:37:40

168:00:00

0:00:00

Problem KCowboy Checkers

Theta likes to play a board game called Cowboy Checkers, also known under the name “Nine Men’s Morris.” This strategy board game, which dates at least to the Roman Empire, is played by two players on a grid with $24$ intersections, or points, as shown on the left in Figure 1. Each player has nine pieces represented by white and black colors. During the initial phase of the game, players take turns placing pieces on the board at unoccupied intersections. Once all pieces have been placed, players take turns moving pieces. Pieces can be moved along the lines of the board from one intersection (or corner) to any connected open intersection (or corner).

The goal of the game is to take one’s opponent’s pieces, which is accomplished by forming “mills,” which consist of three pieces that are either horizontally or vertically adjacent. For instance, Figure 1 shows two mills: white has a mill consisting of the pieces on e3, e4, and e5, and black has a mill consisting of the pieces on f2, f4, and f6.

Each time a player forms a mill they can take one piece from their opponent. Thus, a desirable position, which almost always results in a win, is a “double mill”: in this position, the player whose turn it is can move one piece from one mill such that it closes (completes) another mill. In the next move, the player can move back, closing the first mill again and reopening the second. For instance, in Figure 1, White has created a double mill: the move e3 to d3 would close a mill consisting of d1, d2, and d3 while simultaneously creating an open mill e4, e5.

Theta is pretty good at spotting double mills - can you write a program that does the same?

Input

The input consists of a single test case. This test case consists of $7$ lines with $7$ characters each. The letters B and W denote black and white pieces, respectively. The character . denotes an open corner or intersection, except in the center of the board, where it has no significance. The characters | and - are used to denote connector lines that may not contain any pieces. All inputs represents valid positions as far as which points may contain pieces, as displayed on the left in Figure 1. There may be up to nine black and up to nine white pieces on the board.

Output

If White has at least one double mill, output double mill, else output no double mill!

Sample Input 1 Sample Output 1
.--.--.
|.-.-B|
||..W||
.BB.WB.
||..W||
|B-W-B|
.--W--.

double mill

Sample Input 2 Sample Output 2
.--.--.
|.-.-.|
||...||
.......
||...||
|.-.-.|
.--.--.

no double mill

Sample Input 3 Sample Output 3
B--.--.
|W-.-.|
||BBB||
......B
||WWW||
|W-.-W|
.--B--B

double mill

Sample Input 4 Sample Output 4
B--B--.
|W-.-B|
||BBB||
.W....B
||WWW||
|W-W-W|
.--B--B

no double mill