ARTICLE AD BOX
I found this technical test, but i cannot solve, the original one is in spanish
The problem:
"Domo Arigato Mister Roboto (hereafter DAMR™) is a robot created by the company ECReLA S.A. to assist with loading tasks when assembling large telescopes being built in various countries around the world, which will ultimately provide valuable information to the scientific community, and also more work for astronomical brokers who consume this information, so that scientists can observe and analyze interesting possible events with greater precision.
The problem is that the robot broke down a few days ago and we have been unable to determine the cause. We believe there is a series of instructions that disabled it and we have saved the records of its last instructions in RAM memory:
UNDDNNUUNNNUUUUNNNNUUUUUNNUUUUUNNUUUUUNNNNSDDNNUUNNNUNDNNSUNUUUNNUUUUUNNNNUUUUNNNDDDNNUUUUUUNNDDDNNUUUUUUNNUNNNDNNUUUUUUNNS
We have been investigating how to decode the meaning of this set of instructions, and to achieve this we have been having long reading sessions of the robot's original manual, which has more than 1300 pages detailing the entire internal operation of its systems. But since we are good people, we will make a summary of the DAMR™ communication system so you can familiarize yourself with it. You can review it on the next page.
In case you hadn't figured it out, your task is to help us find the last sentence the DAMR™ displayed before it stopped working.
5. Communication System
5.1. The DAMR™ has a linear memory, which can only be traversed to the right.
5.1.1. Each memory slot has 10 possible values, being the digits 0 to 9.
5.1.2. To modify the memory elements, the main pointer must be manipulated, starting at the initial slot.
5.1.3. The default value of slots is 0.
5.2. The communication system processor understands 4 instructions: Go up (U), go down (D), go to next (N), and send (S).
5.2.1. U and D modify the value of the slot the main pointer points to. U moves it up. For example, if the slot has value 0, applying this instruction makes its value 1. Likewise, D moves it down. NOTE: Values are cyclic, which means U on 9 is 0 and D on 0 is 9.
5.2.2. N changes the slot the main pointer points to by one adjacent to the right.
5.2.3. S takes care of displaying what is in memory on the screen.
5.2.4. After executing the S instruction, the pointer returns to the beginning and all slots are reset to their default value.
5.3. The DAMR™ represents words in the following way:
5.3.1. Each letter has its correlation with the order in the alphabet (A = 1 and Z = 26).
5.3.2. Each letter is separated by a 0.
Example a. Basic message
Set: DDNNUNUUUUNNUUNUUUNNUS Result in memory: 8 0 1 5 0 1 2 0 1 Output on screen: **HOLA
So I made this**
string = "UNDDNNUUNNNUNUUUUUNNUNUUUUNNUUNUUUUUNNUUNNNSDDNNUUNNNUNDNNSUNUUUNNUNUUUUNNUNNNUUNUUUNNDDDNNUUUUUUNNDDDNNUUNUUUUUUNNUNNNUNDNNUUUUUUNNS" alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def group(memory): groups = [] current_number = "" for val in memory: if val == 0: if current_number: groups.append(int(current_number)) current_number = "" else: current_number += str(val) if current_number: groups.append(int(current_number)) return groups def decode(groups): return "".join(alphabet[n - 1] for n in groups) numbers = [] slot = 0 for ch in string: if ch == 'U': slot = slot + 1 if slot == 10: slot = 0 if ch == 'D': slot = slot - 1 if slot == -1: slot = 9 if ch == 'N': numbers.append(slot) slot = 0 if ch == 'S': print(numbers) print(group(numbers)) print(decode(group(numbers))) numbers = []And the output
[1, 8, 0, 2, 0, 0, 1, 5, 0, 1, 4, 0, 2, 5, 0, 2, 0, 0] [18, 2, 15, 14, 25, 2] or [18, 20, 15, 14, 20] RBONYB or RTONYT [8, 0, 2, 0, 0, 1, 9, 0] [8, 2, 19] or [8, 20, 19] HBS or HTS [1, 3, 0, 1, 4, 0, 1, 0, 0, 2, 3, 0, 7, 0, 6, 0, 7, 0, 2, 6, 0, 1, 0, 0, 1, 9, 0, 6, 0] [13, 14, 1, 23, 7, 6, 7, 26, 1, 19, 6] or [13, 14, 10, 23, 7, 6, 7, 26, 10, 19, 6 ] MNAWGFGZASF or MNJWGFGZJSFSo I suspect there's no valid result, or there's something that I am missing
