Problem K
TacTix
Languages
da
en
TacTix is a strategy game for two players invented by the Danish poet, designer, and author Piet Hein (1905–1996). The game is extensively described in Martin Gardner’s book Hexaflexagons and Other Mathematical Diversions: The First Scientific American Book of Puzzles and Games, 1988.
TacTix is played with $16$ pieces on a $4\times 4$ board labeled A to P. Players take turns to remove pieces. A move consists of a player removing between $1$ and $4$ pieces; the pieces must be adjacent and belong to the same column or row.
We consider the so-called misère version of TacTix. Unlike “normal” TacTix, the goal is to not take the last piece. Here is a game where player $2$ (the blue player) wins, as red is forced to take the last piece.
Write a program for player $2$ that always wins.
Interaction
The interaction begins with the move of player $1$. Then you write your move, and you take turns until someone wins. Each move consists of a single line with a legal move indicated by uppercase letters A to P, separated by spaces.
Read | Sample Interaction 1 | Write |
---|
C
M N O
F G
D H L P
A
I J
B
E
K