There are blue dwarves and white dwarves, totally 1000 of them. The two types of dwarves are on opposite teams. One blue dwarf and one white dwarf found a bead necklace with red and black beads ending in a single pearl. Each team wants to get hold of the pearl.
To achieve this, they play a game:
Each dwarf D is given two lists, a red list RD and a black list BD. Both RD and BD are sets of dwarves (these sets may contain dwarves of either colour, but are guaranteed to be nonempty).
The necklace is given to one of the dwarves D. His moves are:
You are given:
Your aim is to determine whether the dwarf can ensure that the pearl eventually reaches another dwarf on his own team.
The current position of the game is completely described by The quantities (D,N) where
Call this a configuration. For each pair (D,N), label the configuration as W (winning) or L (losing). If the label is W, D can ensure that the pearl reaches his team. If the label is L, no matter what D does, the pearl reaches the other team.
We work backwards from the last bead in the necklace. If the necklace is currently a single pearl, the configuration is winning for all D.
Now, we step back once so that we have a configuration (D,bk). Depending on the identity of D and the lists he has, we know whether this is winning for the team that D belongs to.
If D is white, bk is red and there is at least one white dwarf D' in the list RD, then D can revmove bk and hand the necklace to D', who gets the pearl. So, this configuration is winning.
On the other hand, if RD has no white dwarves, D must hand over the necklace with just the pearl to some blue dwarf, so (D,bk) is labelled L.
Similarly, if bk is black, (D,bk) is winning if there is at least one white dwarf D' in the list BD and (D,bk) is losing if there is no white dwarf D' in the list BD.
In general, assume that we have calculated the status of (D,N) for N = b1 b2 ... bk. We can now calculate the status if we add an additional bead b0 to the left of N.
Suppose b0 is red and D is a blue dwarf. Then we can label (D,b0...bN) as W if either of the following hold:
Otherwise, label (D,b0...bN) as L (D cannot avoid making a move that leads to a losing position).
Make similar updates for the other three possibilities for b0 and D — (b0 is black and D is white), (b0 is black and D is blue) and (b0 is red and D is white).
In this way, we can work backwards and label the initial configurations at W or L.
©IARCS 2012–2016
Pěstujeme web | visit: Skluzavky