F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Abalone

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 231    Accepted Submission(s): 70


Problem Description
Abalone is a popular board game, the rules are as follow:
1.At first, two players each have 14 marbles, starting to play in turn.

2.For each turn, player must move a line of one, two or three adjacent marbles one space unless he couldn't move any marbles. The move can be either in-line (parallel to the line of marbles)

or broadside (not parallel to the line of marbles), as illustrated below.

3.A player can push their opponent¡äs marbles which are in an adjacent space to their own with an in-line move only. They can only push if the pushing line has more marbles than the pushed line (three can push two or one; two can push one). Marbles must be pushed into an open space or out of board(i.e. not blocked by a marble of either colour).

4.The winner is the first player to push six of the opponent's marbles off of the edge of the board.

Now, it's White player's turn to move, could White player win in this turn? If not, Black player moves, could Black player win in next turn no matter which move White player choose?
 

Input
The first line is a number T(1<=T<=30), which represents the number of case. The next T blocks follow each indicates a case.
A block has nine lines. They are the state of the situation.
'B' indicate the Black marble.
'W' indicate the White marble.
'.' indicate blank.
The number of marbles for each color will be no bigger than 14 and no smaller than 9.
 

Output
For each case, output the number of case with "White" or "Draw" or "Black".(as shown in the sample output)
 

Sample Input
3 B B B B B B B B B B B . . B B B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W W W . . W W W W W W W W W W W . . . . . B B B B B B . W B B B . . . . W . . . . . . . . W . . . . . . . . . . . . . . . . . . . . W W W W W W W W W W W . . . . . W B B B . . W W B B B . . W . W B B B . . W W W W . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 

Sample Output
Case 1: Draw Case 2: White Case 3: Black
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-27 00:16:19, Gzip enabled