[HV22.04] Santa’s radians

1 minute read

Santa, who is a passionate mathematician, has created a small website to train his animation coding skills. Although Santa lives in the north pole, where the degrees are very low, the website’s animation luckily did not freeze. It just seems to move very slooowww. But how does this help…? The elves think there might be a flag in the application…

Solution

We got a website with the title The UPICode, and the following slowly spinning circles on it. They speed up when you move the cursor above them but other than that, there is not much going on.

picture of the website showing spinning circles

The source of the website is also available here: source.html

A quick search for UPI Code revealed nothing, but the highlighted word degrees from the challenge description seemed like a big hint, so I converted the radian values to degrees like that:

#!/usr/bin/env python3.11
import math

rads = [2.5132741228718345, 0.4886921905584123, -1.2566370614359172, 0, 2.548180707911721, -1.9547687622336491, -0.5235987755982988, 1.9547687622336491, -0.3141592653589793, 0.6283185307179586, -0.3141592653589793, -
        1.8151424220741028, 1.361356816555577, 0.8377580409572781, -2.443460952792061, 2.3387411976724013, -0.41887902047863906, -0.3141592653589793, -0.5235987755982988, -0.24434609527920614, 1.8151424220741028]


def degree(x):
    return round(x * 180 / math.pi)


degs = list(map(degree, rads))

The degrees now are [144, 28, -72, 0, 146, -112, -30, 112, -18, 36, -18, -104, 78, 48, -140, 134, -24, -18, -30, -14, 104].

Knowing that the flag must be in the format HV22{...}, I looked at the numbers and noticed that H has ascii code 72, which happens to be half of the first value, so I applied / 2 to all values: [72, 14, -36, 0, 73, -56, -15, 56, -9, 18, -9, -52, 39, 24, -70, 67, -12, -9, -15, -7, 52].

This helps a bit, but since second character should be V with ascii value 86 instead of 14, which is a non-printable control character.

It took a bit of staring at the numbers to notice that this is like a pointer where each next value points at a valid ascii character relative to the previous position. I implemented the solution like this:

#!/usr/bin/env python3.11
import math

rads = [2.5132741228718345, 0.4886921905584123, -1.2566370614359172, 0, 2.548180707911721, -1.9547687622336491, -0.5235987755982988, 1.9547687622336491, -0.3141592653589793, 0.6283185307179586, -0.3141592653589793, -
        1.8151424220741028, 1.361356816555577, 0.8377580409572781, -2.443460952792061, 2.3387411976724013, -0.41887902047863906, -0.3141592653589793, -0.5235987755982988, -0.24434609527920614, 1.8151424220741028]


def degree(x):
    return round(x * 180 / math.pi / 2)


degs = list(map(degree, rads))

p = 0
for x in degs:
    p += x
    print(chr(p), end='')

print()

This returns the flag HV22{C4lcul8_w1th_PI}

Updated: