Challenge Overview

This is the Easy - 250 point problem of RDM-Practice
Consolidated Match Leaderboard is available here.

Please Note - The files linked in the specs will only be accessible after you register for the challenge.
p5r5tBCd3B

 

You are an adventurous explorer. One day, you come to a castle called the TCO20 Castle in order to find the treasure that’s said to be hidden inside. The treasure is known to be stored in a mysterious box. The only way to get to the treasure is to find the key that unlocks the box. You look for clues floor, by floor. When you come to the 64th floor (Hint: something to do with Base 64 encoding), you find the following string of text written on a paper:

e0MgIjpUMDJleSIia095aXNfX3J1aGl7c3RvZXRfZWsifWVjX3JzeX0=

Below the string, there’s a message: "13 is your lucky number. You will need to decipher the message into a valid JSON object."

Upon reading this, you start brainstorming. You are eventually able to successfully figure out the steps that would allow you to solve the puzzle and grab the treasure.

But now comes the main requirement! You have to implement your steps in a software application.  This application should be a frontend web app, and the main goal of this application is to decipher the key from the symbols and get the JSON output. 

The following are the steps that you have come up with, which you now need to implement into an app.

Steps to Decipher:

(1) First, your app will need to decode the base64 string.

(2) Once decoded, from the decoded string extract the substring inside the outermost  {}, and follow the steps below.

(3) Split the message into separate rows. Each row should contain 13 characters. Affirming that when you write the algorithm later to process each row, you can safely assume that each row will indeed be of length 13.

(4) Manually unscramble the first row into human-readable words. That is, rearrange the characters in the first row such that they start making sense. Every character, including space, quotes, braces, etc are important. Do not discard any character. You are expected to only rearrange the characters. You will always rearrange the character within the same row. A character will never be moved to a different row.

(5) Apply the same rearrangement order from the first row to the remaining lines.

  • Example: If, in the first row, the string is “dPresient”, and you figure out that you need to move the character d (at index 0) to index 5 (so that the “unscrambled” string says President), for ALL the other rows a character at index 0 will always be moved to index 5.

  • Thus, if you correctly figure out the arrangement of characters in the first row, you will automatically figure out the arrangement of the characters in the rest of the rows

  • Additionally, for EVERY input text, you will follow the same arrangement. That is, if you figure out the arrangement for the provided example, you can use the same rearrangement order for ALL other input and thus translate your understanding into code that can be easily applied to decode additional inputs.

(6). After unscrambling the rows, it will be human-readable text.

(7). Concatenate all the rows into a single string. Enclose this string in { and } characters. Remember: The final output is a well-formed JSON object. 

The JSON output you get will lead to the treasure!

Requirements for the UI

Create a web UI with a single page. This page needs to be the index page of your web app and must contains these elements:

  • A textarea with id ‘input’. This textarea is the input where users input the provided characters.

  • A button with text Decipher below textarea. The button must be of type=”submit”. Click this button to run the deciphering process and return the value to an ‘output’  textarea.

  • A second textarea with id ‘output’ below the Decipher button. This textarea is the output where users see the deciphered result.  You should output the full valid JSON string.

Following the above requirements will help the automated-tester to validate your submission.

NOTES: 
- The UI should be simple. It only needs to be functional and it’s not necessary to make it look nice.
- In case you are submitting a static HTML solution, you need to provide a script to serve the static HTML/JS/CSS files on port 8080.
 

Testing

During the system testing, there will be many other base64 encoded strings that need to be deciphered in the same way. The algorithm will be consistently applied to each input. Thus, your code should not just be hardcoded to deciphering the sample string of e0MgIjpUMDJleSIia095aXNfX3J1aGl7c3RvZXRfZWsifWVjX3JzeX0=.
 

Sample Submission

This challenge uses a purely automated testing approach to score the submissions so we are providing a sample submission and an automated tester with a basic test case assembled in a way that simulates the final testing. Docker is used to achieving this. Please read the README.md file to find out how to run the setup.

The sample submission will be in the code folder and it should be extended to implement the requirements. The README.md file contains some guidelines on how to extend the sample submission.

Sample submission with local tester for this challenge: easy-sample-and-tester.zip
Sample Submission to submit on the platform: easy-sample-submission.zip



Final Submission Guidelines

Submission Deliverables

Your submission must be a single ZIP file not larger than 10 MB containing just the code folder with the same structure as the one from the sample submission. The sample tester should not be included in the submission. Also make sure you don't submit any build folders generated locally like node_modules, dist etc.

You must follow this submission folder structure so our automated test process can process your scoring:

  • Create a folder with “code” as the folder name then zip. 
  • Inside the “code” folder, there needs to be a file named Dockerfile. This is the docker file used to build the user’s submission. Refer to the provided Docker file in Sample Submission for each level.
  • Zip that “code” folder and submit to the challenge.

Execution Details and Submission Logs

Each time you submit, the platform will leverage Docker to run your code. The execution logs will be saved as “Artifacts” that can be downloaded from the Submission Review App: https://submission-review.topcoder.com/.

RDM-Execution-logs

RDM-Execution-Logs-2

Checking Passing and Failing Test Cases

Using the Submission Review App (https://submission-review.topcoder.com/), navigate to the specific challenge, then to your submission, and then to the Artifacts for your submission. The zip file you download will contain information about your submission including a result.json file with the test results.

Docker Structure

Make sure you can run your submission with Docker from a clean slate. Your Docker needs to expose port: 8080. It needs to build on a completely clean machine when the platform runs your submission. If you are using something locally to build and run your submission, make sure it’s included as part of your Docker configuration as well. Please look at the sample submission to understand the structure better.

 

ELIGIBLE EVENTS:

2021 Topcoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30162204