Predictable Board Game on 10 Boards

Problem #283

Tags: unlabeled

Who solved this?

No translations... yet

This new version of the problem seemed such an obvious extension that I couldn't resist it. (c) Clive Fraser aka CSFPython (thanks!).

You should have solved the problem Predictable Board Game before attempting to solve this one. It is not an advanced version of the original problem because it does not involve finding a more efficient way of solving the original problem. Although it requires ideas that you will have used to solve the original problem it is a substantially different problem in its own right. You will need to refer to the original problem for the rules of play.

Having worked out how to predict the result of their board game, the two friends decided to increase the complexity of the game by having 10 boards instead of one. To keep things manageable they decided to have the x and y coordinates on each board restricted to the range 0 to 100 inclusive. The starting position for the game has a disc placed on one of the squares in each of the ten boards. These positions are chosen randomly for each board and could include the origin. It is possible that two or more boards might have discs in identical positions. The two friends take turns to move a single disc on any of the boards, using the original game moves. For any move they can select any one board for the move, provided that the disc is not already at the origin of that board. The game ends when discs are at the origin in each of the 10 boards. The winning player is the one who makes the final move.

After playing this game for some time the friends became convinced that, despite the increased complexity, the game must still be predictable from the starting position across the ten boards. This is indeed the case. From a given starting position across the 10 boards you need to decide whether the position is a win (W) for the first player or a loss (L); assuming optimum play by both players.

Input / Output description:
The first line of the input data will contain a single integer N.
N lines will follow. On each line there will be 20 integers (separated by single spaces). These are the (x,y) coordinates of the disc positions. Each line will have the format: x1 y1 x2 y2 x3 y3 x4 y4 ... where x1 and y1 give the starting coordinates of the disc on board 1. For each position answer W or L to indicate winning or losing. Give all answers on a single line, separated by single spaces.

Example:

input:
14
47 95 99 52 30 88 53 37 54 56 15 72 61 99 26 0 95 17 76 55
69 39 30 4 75 26 51 2 24 39 75 28 17 31 77 42 20 60 16 89
4 39 87 44 11 50 47 50 83 27 29 24 21 94 46 78 91 68 38 62
6 49 30 49 67 40 21 35 35 50 49 17 28 18 72 85 33 61 50 30
26 49 15 53 53 64 98 4 50 79 66 65 17 50 24 50 10 6 47 54
76 35 8 26 67 64 66 73 63 90 44 27 22 33 81 79 44 39 33 22
15 23 44 27 26 24 2 33 16 26 93 60 38 62 12 61 90 81 43 2
17 28 28 17 0 73 50 31 67 46 5 35 21 34 45 54 12 68 35 98
92 77 39 94 64 21 59 50 88 34 28 100 55 52 61 91 48 78 34 53
29 47 24 95 23 17 0 61 10 6 64 29 20 12 39 69 10 47 22 86
88 16 76 10 51 48 90 43 46 30 5 65 55 93 84 96 70 43 15 9
30 30 74 16 73 45 39 90 87 42 37 72 94 83 19 68 96 48 15 9
86 14 5 25 24 14 96 3 22 14 60 89 13 27 29 81 6 10 61 77
31 88 94 58 24 30 85 8 32 5 93 2 1 84 0 0 75 97 94 63

answer:
L L W L L W W L W W L W W L
You need to login to get test data and submit solution.