🏮🕯️Puzzle 18 — The Lantern Pattern 🏮🕯️
As the nights pass, Mustafa learns that the illuminated man does not appear every night — but whenever he does, something unusual is recorded by the caretakers of the mosque courtyard.
The courtyard is lined with long rows of lanterns. After Maghrib, these lanterns are lit.
Throughout the evening, volunteers perform regular safety rounds, recording the lantern state every few minutes:
They each have a small wick that can be lit or extinguished.
Every few minutes, a caretaker records the current lantern state into a log:
- Lit lanterns are marked as #
- Unlit lanterns are marked as .
By the end of the month, thousands of lantern snapshots have been logged. Many per night, over many nights.
Most of them mean nothing...
But the caretakers have noticed that whenever the illuminated man is reported to have appeared, a specific configuration of lanterns is present somewhere along the row — always the same shape, 12 lanterns in span, never the same place.
"The light leaves a trace," the old man once said.
This is causing speculation in the mosque and whispers in the congregation are alluding to something that no one wants to say outright.
Members of the community have circulated the hadith that "angels are created from light".
Your input file
You are given a fille containing thousands of lantern snapshots.
- Most snapshots are random
- A single lantern pattern appears repeatedly
- This pattern:
- Is 12 lanterns long
- Appears in many different snapshots
- Appears contiguously
- May shift left or right
- Most other patterns are noise
- Is present only when the illuminated man is seen
Your task
Identify the repeating 12-lantern pattern
for example:
##.#..#..##..
- No spaces
- The pattern must be exactly 12 characters long