44. Rock, Paper, Scissors
Johann arrived in Reval three days later, unannounced, with a thin excuse about an aunt in Kalamaja whom he did not visit once during his stay.
„I could not sit in Dorpat,“ was all he admitted, „with that canvas in the next street and no one to speak to about it.“
Mihkel took him to the market square on Saturday, partly for the herring and the wool, mostly to give his friend something loud to look at.
Near the weighing house a cooper had set a barrel on end and chalked a board against it. Eight men, eight coins into a clay pot, and the pot to whoever remained. Stone, paper, shears— a children's game the town had lent to grown men, who took it far more seriously.
„The first pair!“ the cooper bellowed, and the square obliged him with a crowd.
Johann was enchanted at once. He shouted advice at strangers, accused a fishmonger of cowardice, and declared after each round that he had known it all along.
Mihkel watched differently. He watched the hands.
Every man threw three times at most— once in the first round, once more if he survived it, a third time if he reached the end. Three decisions, and then the game was finished with him. By the second contest of the afternoon Mihkel had taken out his notebook and begun to write them down: eight columns, three letters each, the whole day reduced to a small grid of hands.
He was not predicting anyone. He had no intention of returning next week to catch these men in their habits. The games were already played; the coins were already spent.
But a question had arrived and would not leave: if I had stood in the first place on that board, knowing everything I now know— which three throws would have carried me through all three rounds?
It was not a matter of guessing. Each answer changed the next question. Beat the second man, and one opponent waits; the other half of the board resolves without you, quietly, by its own rules, and delivers whoever it delivers. Foresight was the wrong word. It was bookkeeping performed forwards.
That night, in his childhood room, with the Logic Mill four days' road away beneath its canvas, Mihkel wrote the rules as though writing for the Mill, and then—having no Mill— obeyed them himself, slip by slip, refusing to skip ahead.
On the input tape you'll get 8 players in a single-elimination Rock Paper Scissors tournament,
separated by :. Each player is a sealed strategy: a string of 3 throws
(R = rock, P = paper, S = scissors),
one throw for each round they might survive.
In round 1 the 1st player fights the 2nd, the 3rd fights the 4th, and so on; each winner climbs to the next round. With 8 players there are 3 rounds, until a single champion remains. A player uses their leftmost unused throw each round — their 1st throw in round 1, their 2nd throw in round 2, their 3rd in round 3. Rock beats scissors, scissors beats paper, paper beats rock. The sealed players never tie against each other.
You play the 1st player, shown as @@@ — 3 throws you have not yet chosen.
Replace @@@ with the strategy that makes you win the whole tournament,
and leave the rest of the tape untouched. Such a strategy always exists and is unique.
For example, if the input tape is:
@@@:RPS:PPR:SSP:RRS:PSP:SRR:PRP
the output tape is:
PRP:RPS:PPR:SSP:RRS:PSP:SRR:PRP
Round 1: your opponent is the 2nd player, whose 1st throw is R, so you throw P.
Round 2: the 3rd and 4th players meet (P vs S), the 4th survives and shows its 2nd throw S,
so you throw R.
Round 3: the last four resolve to the 7th player, whose 3rd throw is R, so you throw P.
Your winning strategy is PRP.
Thanks to kyroos for the inspiration for this quest!