In a game, two players control an adventurer in a dungeon. The adventurer starts with $H{}$ hit points, an integer greater than one. The dungeon consists of several chambers. There are some passageways in the dungeon, each leading from a chamber to a chamber. These passageways are one-way, and a passageway may return to its starting chamber. Every chamber can be exited through at least one passageway. There are 5 types of chambers: Entrance: the adventurer starts here, no passageway comes in here; Hollow: nothing happens; Spike: the adventurer loses a hit point; Trap: the adventurer gets shot by an arrow; Catacomb: the adventurer loses hit points equal to the total number of times they have been hit by an arrow. The two players control the adventurer alternatively. At a turn, a player can move him through one passageway. A player loses if the adventurer’s hit points fall below zero due to their action (at 0 hit points, the character is alive). Construct a dungeon map, which has at most 20 chambers in total and exactly one entrance, with the following condition: the first player has a winning strategy if $H{}$ is a prime, and the second player has a winning strategy if $H{}$ is composite. Note: If the game doesn’t end after a finite number of moves, neither player wins.
Problem
Source: 17th Durer Competition 2023 E+ P4
Tags: combinatorics
30.11.2023 16:14
Very fun problem to solve! I'll use crypt instead of catacomb and empty instead of hollow. Here's the game map I came up with. It has 17 chambers, very nicely drawn and color-coded: I'll provide a brief explanation on what happens. First, assume that $H{}$ is composite and let $H=TC$ with $T,C\geqslant 2$. Basically, the second player uses the trap loop to trigger a total of $T{}$ traps. If at some point the first player decides to take the secondary path rather than returning to the empty cell in the trap loop, preventing the second player from triggering a total of $T{}$ traps then the second player can safely bypass the crypt on the secondary path (he takes $T'\leqslant T\leqslant H/2<H$ damage) and after that the first player enters the killing loop and loses. Once there are $T$ triggered traps (we assume that the first player didn't kill himself in the process), then the second player takes the main path, entering the crypt loop and passes through it forcefully $C-1$ times. When he enters the very next crypt, outside the loop, he will have dealt exactly $CT=H$ damage, hence the character has 0 health, so when the first player passes through the upcoming spike he loses. Therefore, the second player has a winning strategy in this case. If $H{}$ is prime then the secondary path actually allows the first player to make sure that the game does end. If the second player stalls too much in the trap loop, once he has triggered enough traps (strictly more than the health), the first player can take the secondary path and this time the crypt will kill the second player. Thus, the second player loses or eventually he has to continue on the main path (and as we'll see in the next paragraph, he still loses). So let's say the second player takes the main path. Because of the layout of the game map, at least two traps are triggered and at least two crypts are entered, so either player two loses before getting to the last crypt (he is the only one taking damage so far) or he does reach the very last crypt, the damage deakt being a composite number. Since $H{}$ is prime, then the character has at least 1 health, so the first player can safely pass through the upcoming spike, leading the second player to the killing loop, so player one wins. Thus, the first player has a winning strategy.
30.11.2023 23:09
E -> S -> T <-> H -> C -> H -> S -> H -> C <-> S works with 10 chambers. Proof is left as an exercise to the reader. Currently trying to push it down to 9.
30.11.2023 23:20
AdventuringHobbit wrote: E -> S -> T <-> H -> C -> H -> S -> H -> C <-> S works with 10 chambers. Proof is left as an exercise to the reader. Currently trying to push it down to 9. After E->S->T->H (forced), it’s the second player’s turn to move. Can’t they always move H->T, forcing the first player to move T->H? In this manner the second player makes the game go on indefinitely and the first player can’t guarantee a win when $H$ is prime (nor for any other $H$, for that matter) In particular I think that any “trap loops” of T<->H, provided that every move leading up to them is forced, must have two exits, otherwise one of the players can stay all indefinitely and prevent the other from ever winning (at least for $H$ large enough so that the player doesn’t die on the way to the trap loop)
30.11.2023 23:23
oh oops I forgot about indefinite games... I had a construction with 12 that didn't have this issue. I'll edit that one in. (Edit now I got 10 for real) E->T->S<->T->C<->H->S->S->S<->H (Edit Now I got 9)
01.12.2023 03:32
It does not seem that hard to bash out all state cases now for minimal sol.