Visual illustration of the code challenge: Greenoid #7 - A message to pass on

Greenoid #7 - A message to pass on

Coding in the sandbox You must be logged in to access the sandbox.

Mission

By activating the right valves, you manage to flood part of the Abyssum network infrastructure, which seems to be temporarily out of action. The countdown suddenly freezes, and AURA's voice echoes in the database: ‘Data modified. Risk reassessment calculation. Human interference suspected.’ You freeze. But this is no time to succumb to fear. It's time to warn the Greenoid tribes of the danger they're in. You take advantage of the general confusion to write a clear message: ‘An artificial intelligence is preparing to wipe out humanity, we must absolutely abandon Abyssum and reconsider the practices that threaten the balance of Greenoïd.’ You also include evidence of the imminent threat posed by AURA.

However, you face a major obstacle: the tribes have turned in on themselves and jealously guard their communication networks. Each tribe has its own frequency, and messages only travel individually, from tribe to tribe, but never all at once. Would it be possible to find a universal code capable of broadcasting your message to all the tribes simultaneously? Time is running out. You're in a race against time to send your message before AURA finalises its calculations and relaunches its plan for destruction.

Rules

You have at your disposal the communication keys of Greenoid's 8 main tribes. These keys allow each tribe to communicate 1 to 1, but never several to several. So you need to find a common key that will allow you to communicate with all the tribes at once!

To do this, follow these steps:

  1. Conversion of the keys to 8-bit binary

To do this, each character of the key has a value:

  • a ‘0’ is worth 0, a ‘1’ is worth 1, a ‘2’ is worth 2, a ‘3’ is worth 3, up to 9
  • an ‘a’ is worth 10, a ‘b’ is worth 11, a ‘c’ is worth 12, and so on.

The values of each character must be summed (in base 10) and then transformed into base 2 over 8 bits.

Example:

'ab34' ⇒ 10 + 11 + 3 + 4 ⇒ 28 ⇒ 11100 ⇒ 00011100

  1. Composition of all the keys

We now need to analyse all the key pairs to determine their ‘composition’.

Composition works as follows:

If 2 bits of similar position are identical on each key, then the composition bit is 1, otherwise it is 0.

Example of a 4-bit composition:

  • key 1: 1001
  • key 2: 1100
  • composition: 1010

You therefore need to determine all the possible compositions, without duplicates. If you have analysed key 3 with key 5, you no longer need to analyse key 5 with key 3.

  1. Sorting and rearranging in base 10 and then in characters

All these binary values must be sorted in ascending order and then converted back to base 10.

To create the final key, you need to reapply the rule from step 1 in the other direction. To do this, you need to apply a modulo 36 to each of the values

If you have these 4 values :

  • 11000100 ⇒ 196 ⇒ 196%36 ⇒ 16 ⇒ ‘g’
  • 10010000 ⇒ 144 ⇒ 144%36 ⇒ 0 ⇒ ‘0’
  • 10110010 ⇒ 178 ⇒ 178%36 ⇒ 34 ⇒ ‘y’
  • 11110011 ⇒ 243 ⇒ 243%36 ⇒ 27 ⇒ ‘r’

In ascending order of values: 144, 178, 196 and 243

The final key would therefore be ‘0ygr’.

You must return the final key.

Solve the challenge

To code this challenge, several possibilities:
- Want to start coding right away? Use the online Sandbox.
- Want to work in your favorite editor? Organize your code well, test, check out our API documentation.
- You can also copy/paste a dataset below.

challenge code for resolution via API: GREENOID_7

Some resources to help you:
Data and algorithmic logic Methodologies Corrections

Support for resolution

Progress through challenges using our resolution aids: tools, techniques and advice to help you overcome the most complex programming challenges with methodology, confidence and creativity.

Dataset and algorithmic logic

Based on the data and the expected response, use the process to determine the logic to implement.

Show data and progress

Methodologies

Develop a structured approach with our solving guides. Work on specific concepts such as object-oriented programming or unit testing to improve your coding style and progress.

No methodology yet for this challenge, but we are working on it! Follow us to be informed of the release!


Corrections

The corrections allow you to discover certain technical concepts but will also give you a solution to the challenge. Code the challenge yourself before consulting the corrections ;)

Programming concept(s) that can be used to solve this challenge: Booléens, Fonctions, Parsing, Cryptographie, Chaines de caractères, Calculs

Keep coding

Other challenges to complete

Intermediate
Bulma et la Capsule Corp.

Bulma et la Capsule Corp.

Aide Bulma à faire le tri dans ses capsules !

Hack Corrigé disponible : PHP
Intermediate
Code secret et énoncé secret !

Code secret et énoncé secret !

Un challenge sans explications… Quelques exemples, à toi de craquer l’algorithme !

Hack
Beginner
Données à nettoyer

Données à nettoyer

Des adresses mails sont cachées dans ces données. Sauras-tu faire un peu de nettoyage pour y accéder ?

Hack