March 21, 2026

Solution for Codyssi 2025 - Aeolinan Transmissions

Link to the puzzle text

Part 1

In this puzzle we are given multiple puzzles consisting of many characters. We are asked to find how many memory units each message will take up. The memories required depends on the character and is equal to its position in the alphabet.

We can get the position of a character from the Python function ord, which translates a single character into its ASCII value. In ASCII, the alphabet is consecutive, so subtracting the start of the alphabet (ord("A")) returns the position in the alphabet. Finally summing up all the positions of the message for all messages gives us the answer. 

Part 2

In part 2, the messages are compressed using a custom lossy algorithm first. Instead of a full message, only the first and last few characters character are used and the middle is replaced by the number of characters removed. We are again asked for the memory usage of the messages. The numerical character take up memory units equal to their value.

Replacing the message with its compressed version took just some string manipulation. The previous memory calculation needed to be updated to allow numerical characters, while the rest of the program stayed the same.

Part 3

In part 3, the messages are compressed using a run-length algorithm first. Instead of of repeating a character multiple times, it is replaced by the character and the number of repeats. So replacing "AAAAA" by "5A".

We used the itertools.groupby function to seperate the string into the repeating groups. The rest of the calculation was the same as parts 1 and 2.

Link to my solutions

No comments:

Post a Comment