Prázdny
Prázdny

Task 5 will be revealed 20.11.2026 at 18:00 CET

Login required

Coder Games: The Final Undercut

It is race weekend at the Coder Games Grand Prix. Qualifying is over, the cars are locked away in parc fermé, and nobody is allowed to touch them until Sunday. The engineers, however, are not the kind of people who sit still.

To settle team orders, the strategy departments pass the evening on the simulator with an old paddock tradition: the Energy Relay, a duel of pure race strategy in which two teams push energy around a virtual circuit and try to finish every stint with the bigger battery.

Tonight something unusual happened. The rival team's strategy desk has been broadcasting its stint logs (your puzzle input) over an open channel, one line after another, for hours. Every log reveals exactly which commands the rival is going to play. Our analysts are convinced the logs hide a message. Unfortunately, the one machine that could make sense of them, our strategy computer, went down with the rest of the garage when the cars went into parc fermé.

Your job is to rebuild it: a strategist that takes each intercepted log and finds the deploys that beat the rival by the largest possible margin.

The Energy Relay

The circuit

Each team owns six sectors, numbered 0 to 5, and one battery. There are always exactly 48 energy units on the circuit, spread over the twelve sectors and the two batteries.

Energy always travels the same way round. Seen from the team that is moving it, the circuit is a loop:

Energy relay circuit: direction of travel and facing sectors

The opposing team's battery is not part of your loop: you never put energy into it. When the rival moves energy, the same loop applies from the rival's point of view (their sectors, their battery, your sectors, and your battery is skipped).

Sectors face each other across the circuit: your sector i faces the rival's sector 5 - i, and the other way round.

Deploying energy

A move is called a deploy. The team to move picks one of its own sectors that holds at least one unit, takes all the units out of it, and drops them one at a time into the following positions of its loop, one unit per position. With enough units a deploy can go all the way round the loop, and the sector it started from receives units like any other.

  • Slipstream. If the last unit of a deploy lands in the deploying team's own battery, that team deploys again straight away. This can happen several times in a row, for either team.
  • Overtake. If the last unit lands in one of the deploying team's own sectors that was empty just before the unit arrived, and the facing sector holds at least one unit, then that last unit and all units in the facing sector are moved into the deploying team's battery. If the facing sector is empty, nothing special happens and the unit stays where it landed.
  • Chequered flag. After any deploy, if either team has no units left in any of its six sectors, the stint is over immediately: each team moves all units remaining in its own sectors into its own battery.

For example, with the circuit at 0.0.0.0.2.0/20 1.0.0.0.0.3/22, you deploy your sector 0. Its single unit lands in your empty sector 1, which faces rival sector 4 holding 2 units: an overtake, so 3 units go into your battery. The rival now has no units left in any of its sectors, so the chequered flag falls: you move the 3 units still in your sector 5 into your battery as well, and the stint is over at 0.0.0.0.0.0/20 0.0.0.0.0.0/28, a lead of 8. Any rival commands still waiting are never played.

A stint

Each line of a log describes one stint: a starting position and the rival's commands, one sector number per command.

The rival always deploys first, playing its commands in the order they are listed. After each rival deploy it is your turn, and you choose which of your sectors to deploy. The two teams take turns like this, except that a slipstream gives the same team another deploy straight away: the rival then plays its next command, and you choose again. The stint is over once you have responded to the rival's last command.

Keep in mind that the rival's commands were written for a stint that your deploys are now changing, so they don't always fit. When a command points at one of the rival's sectors that is empty, the rival skips it and tries its next command instead. When it is the rival's turn and it has no commands left, the stint is over. And the chequered flag doesn't wait for the rival's commands: if it falls before every command has been played, the stint is simply over at that moment, and it still counts.

Your aim is to choose your deploys so that, when the stint is over, you are ahead of the rival by the largest possible margin. If several ways of playing reach that same largest margin, the best one is the one that needs the fewest deploys.

Telemetry number

When you have found the best way to play a stint, its telemetry number is worked out like this:

  • Take your lead: your battery minus the rival's battery at the end of the stint. (It can be negative if the rival still finishes ahead.)
  • Add 48.
  • Multiply the result by 5.
  • Add the number of deploys you made, multiplied by 11. Every deploy counts, including each extra deploy you make after a slipstream.
  • Keep only the remainder after dividing by 128.

Log format

Every line looks like this:

r0.r1.r2.r3.r4.r5/R y0.y1.y2.y3.y4.y5/Y commands

  • r0 through r5 are the units in the rival's sectors and R is the rival's battery.
  • y0 through y5 are the units in your sectors and Y is your battery.
  • commands lists the rival's commands, one digit from 0 to 5 per command.

Example

Here is a short intercepted log:

5.3.2.3.3.2/9 2.2.1.1.2.4/9 451342
1.1.3.4.3.4/17 2.3.3.2.2.0/3 413204
1.2.2.3.2.0/0 2.2.2.1.0.2/29 130545
2.2.3.2.1.2/13 2.6.0.1.5.4/5 402313
2.3.0.1.2.3/16 1.1.3.5.4.5/2 152401
4.4.1.3.3.0/21 0.4.0.0.1.1/6 120135
3.6.0.2.4.5/14 0.2.0.2.1.2/7 125043
2.0.2.1.2.1/13 1.1.1.2.3.1/18 354205
2.2.4.3.4.1/12 1.0.0.1.2.1/15 451250
2.1.2.1.1.0/18 2.1.4.0.3.0/13 041012
3.2.3.2.2.4/20 2.3.0.0.2.4/1 135012

The first stint

The first line is 5.3.2.3.3.2/9 2.2.1.1.2.4/9 451342. The rival starts with 5.3.2.3.3.2 in its sectors and 9 in its battery. You start with 2.2.1.1.2.4 and 9. The rival's commands are 4 5 1 3 4 2.

The rival's first command is 4. Rival sector 4 holds 3 units: one goes into rival sector 5, one into the rival's battery and one into your sector 0. The last unit did not reach the rival's battery, so it is your turn:

5.3.2.3.0.3/10 3.2.1.1.2.4/9

Your first decision. All six of your sectors hold units, so every sector is a valid choice. A few of them:

  • Sector 3 holds 1 unit, which lands in your sector 4. That sector already holds units, so nothing special happens and it is the rival's turn again: 5.3.2.3.0.3/10 3.2.1.0.3.4/9.
  • Sector 5 holds 4 units: one into your battery, then one each into rival sectors 0, 1 and 2. It is the rival's turn again: 6.4.3.3.0.3/10 3.2.1.1.2.0/10.
  • Sector 4 holds 2 units: one into your sector 5 and the last one into your battery. That is a slipstream, so you deploy again straight away: 5.3.2.3.0.3/10 3.2.1.1.0.5/10. For that extra deploy, sector 4 is now empty, so it is not a valid choice; sectors 0, 1, 2, 3 and 5 are.

Every choice changes what happens next: which units can be overtaken, which of the rival's commands still fit, and how long the stint lasts. Taking sector 3 here, for example, the best you can still do is finish with a lead of 8. What counts is how the stint ends.

The best way to play this stint takes 11 deploys:

Step

Move

Circuit afterwards

1

rival command 4

5.3.2.3.0.3/10 3.2.1.1.2.4/9

2

you deploy 4 : slipstream

5.3.2.3.0.3/10 3.2.1.1.0.5/10

3

you deploy 5

6.4.3.4.0.3/10 3.2.1.1.0.0/11

4

rival command 5

6.4.3.4.0.0/11 4.3.1.1.0.0/11

5

you deploy 0 : the last unit lands in your empty sector 4, facing rival sector 1 with 4 units: overtake

6.0.3.4.0.0/11 0.4.2.2.0.0/16

6

rival command 1 : rival sector 1 is empty, skipped

7

rival command 3

6.0.3.0.1.1/12 1.4.2.2.0.0/16

8

you deploy 1 : the last unit lands in your empty sector 5, facing rival sector 0 with 6 units: overtake

0.0.3.0.1.1/12 1.0.3.3.1.0/23

9

rival command 4

0.0.3.0.0.2/12 1.0.3.3.1.0/23

10

you deploy 3 : slipstream

0.0.3.0.0.2/12 1.0.3.0.2.1/24

11

you deploy 5 : slipstream

0.0.3.0.0.2/12 1.0.3.0.2.0/25

12

you deploy 4 : slipstream

0.0.3.0.0.2/12 1.0.3.0.0.1/26

13

you deploy 5 : slipstream

0.0.3.0.0.2/12 1.0.3.0.0.0/27

14

you deploy 2

0.0.3.0.0.2/12 1.0.0.1.1.1/27

15

rival command 2 , the last one

0.0.0.1.1.3/12 1.0.0.1.1.1/27

16

you deploy 5 : slipstream

0.0.0.1.1.3/12 1.0.0.1.1.0/28

17

you deploy 0 : the last unit lands in your empty sector 1, facing rival sector 4 with 1 unit: overtake

0.0.0.1.0.3/12 0.0.0.1.1.0/30

The rival now has no commands left, so the stint is over. Your battery holds 30 and the rival's holds 12, a lead of 18. No other way of playing finishes further ahead, and none reaches a lead of 18 with fewer than 11 deploys.

The telemetry number of the first stint:

lead                          18
add 48                        18 + 48 = 66
multiply by 5                 66 x 5 = 330
add deploys x 11              330 + 11 x 11 = 451
remainder after / 128         451 = 3 x 128 + 67  ->  67

The other stints

Played the same way, the other ten stints of the example produce these telemetry numbers:

Stint

Log

Telemetry number

2

1.1.3.4.3.4/17 2.3.3.2.2.0/3 413204

111

3

1.2.2.3.2.0/0 2.2.2.1.0.2/29 130545

100

4

2.2.3.2.1.2/13 2.6.0.1.5.4/5 402313

101

5

2.3.0.1.2.3/16 1.1.3.5.4.5/2 152401

114

6

4.4.1.3.3.0/21 0.4.0.0.1.1/6 120135

32

7

3.6.0.2.4.5/14 0.2.0.2.1.2/7 125043

71

8

2.0.2.1.2.1/13 1.1.1.2.3.1/18 354205

97

9

2.2.4.3.4.1/12 1.0.0.1.2.1/15 451250

109

10

2.1.2.1.1.0/18 2.1.4.0.3.0/13 041012

101

11

3.2.3.2.2.4/20 2.3.0.0.2.4/1 135012

115

Read each telemetry number as an ASCII character code, one stint after the other, and the eleven stints of the example spell:

Coder Games

Your task

Build your strategist and replay every stint of your puzzle input, in order.

What does the telemetry say?

One more thing you should know:

This challenge was born and crafted in a land
where two Formula 1 victors were raised by hand:
One claimed two titles in blue and yellow,
The other won in red, a smooth-operating fellow.

A track in Montmeló tests every car's aero to the core.
While down in Jerez, champagne sprayed in years before.

It hosts the Grand Prix where turn 3 never lies.
Identify this land for all to see.
Solving this riddle will be your KEY.

 

Input

You can download the input file HERE.

Output

You can download the correct result HERE.