This project solves a coding exercise where the goal is to decode a visual message hidden in a grid of Unicode characters and coordinates retrieved from a Google Docs URL.
You are provided with a Google Doc containing lines that each specify:
- A Unicode character,
- Its
xandygrid coordinates.
Your task is to write a Python function that:
- Downloads and parses the data,
- Builds a character grid based on the coordinates,
- Prints out the message formed when the grid is rendered in a fixed-width font.
Empty grid positions are filled with spaces. The grid size is determined dynamically based on the largest x and y coordinates.
- All characters follow the format:
<CHARACTER><X><Y>, such asA23. - Coordinates start from (0, 0).
- The document format remains consistent.
- Downloads the text content from the provided URL using the
requestslibrary. - Uses regular expressions to extract all matching character-coordinate patterns.
- Determines the grid size based on the maximum
xandyvalues. - Initializes an empty 2D grid filled with spaces.
- Populates the grid with characters at their respective coordinates.
- Converts the grid into a printable message.
This helper extracts and prints only uppercase letters from the decoded grid to highlight the hidden message.
$ python message_decoder.py
Enter or copy and paste the URL: https://docs.google.com/document/d/your-example-id
decoded message:
F
F
FFF
F
F
F
F
F
F
Fmessage_decoder.py: Contains the complete Python code.README.md: This file.
- Python 3.x
requestslibraryremodule (regular expressions)
Download the python script and open it into your prefered compiler or notebook but colab is recommended because the script was coded on it
pip install requestspython message_decoder.pypatterns = re.findall(r"([^\s\d])(\d)(\d)", url_from_response)This extracts patterns like A23, where:
Ais the character2is the x-coordinate3is the y-coordinate
NDIVHUWO MUNYAI
- 📧 nmunyai11@gmail.com
- 🔗 https://github.com/DataCrafter20
- 🔗 https://linkedin.com/in/ndivhuwo-munyai-390a58337
This project is licensed under the MIT License.