Change the wording, keep your experiment. Saved in this browser when storage is available.
Reverse engineering / A light-routing puzzle
Can you copy a program
without seeing its code?
Imagine rebuilding a game whose source code is missing. You can still play the original. Can you work out its rules by watching what goes in and what comes out?
Try it here: send the same light beam through two machines. Change your copy’s rule until both send the light to the same exit. Then use that rule to build a light maze you can download.
Try the first comparisonWhy this matters when you use AI
AI can help you rebuild a program from examples. But matching a few examples is not enough. Try an input that could reveal a wrong rule. Then change the rule and test again.An AI coding assistant can help write a replacement from examples. But a version that works on the examples you gave it can still fail on something new. Your job is to find the test that exposes the missing behavior, then check the repair.
Here, you choose from three possible rules to practice that job. This is a simulation built with AI assistance, not an AI generating a program as you play.
01 Find a test that breaks your guess
Goal: make the exits matchThe left machine is the one to copy. The right shows what your current rule predicts for exactly the same beam and mirror. You change the rule on the right; the left machine’s behavior stays fixed.
- Send blue first. Your first guess is that every beam follows the drawn mirror.
- Change only the color to red and send again. Do the two exits still match?
- If they disagree, change the red rule below. Then test again to see whether your repair works.
How to read the beam and mirror
A pulse is one beam of light. The travel direction is where it is moving: north means up, so it enters from the bottom. The / or \ line is the mirror. Rotating it changes which way the light turns. These are game rules, not a simulation of real colored light.
Send a pulse to discover its exit.
Your rule predicts the outgoing path.
Why change the color instead of repeating blue?
Another blue beam cannot separate these guesses: they all predict the same exit. Red makes them disagree. That is why changing the color teaches you more than repeating a test they all pass.All three possible rules handle blue the same way. Red makes them predict different exits, so it can reveal which explanation fits. Testing something your examples did not cover is how you catch a convincing but incomplete replacement.
Your guess for the copy
All three guesses agree on blue. What should red do?
Same mirror means red follows the / or \ line you can see, just like blue.
Check more than your first example
Does your repair work on every input?
No inputs observed yet. All 16 are unknown.
A match on one beam is only one test. 4 directions × 2 mirror positions × 2 colors = 16 tests. Check them all before trusting your rule. This checks where a single mirror sends the beam; the maze below also depends on where you place the mirrors.
✓ Matches × Different ? Not observed
Select a tile to replay that input above.
02 / Make something with your rule
Use your rule
to build a light maze.
Each mirror below uses your chosen rule. Arrange them to send the beam to the star. If you change the red rule, every red turn in your maze changes with it.Now put your rule to use. Each mirror in this maze behaves like the machine you just tested. Place mirrors to guide a beam from the entrance to the star. Changing your red rule changes how red travels through the whole maze.
There is a wrong turn in the starter. Can you repair it?
Read the beam’s route
Run your level to read its route.
Show a worked solution
For blue, put / mirrors in row 3, column 3 and row 1, column 3. Leave the other tiles empty. The first turns north; the second turns east toward the star. For red, use what your current rule predicts.
→ Entrance: row 3, column 1 ★ Goal: row 1, column 5
Keyboard: Tab to a tile, Enter to change it. Arrow keys move between tiles.
03 / Try a fresh machine
Will the same rule work on another machine?
A second machine looks identical but may behave differently. This is why a replacement that passed your first checks still needs testing when the original software changes. Try red before trusting your current rule.
Currently investigating: the original machine.
Keep what you made
Your arcade, ready to play.
Save a standalone game with your layout and rule. It works offline and stays editable. Save your investigation to keep every probe, the layout and your selected controls. Restore that file here to continue. Work stays in this tab until you save a copy.
Where AI fits in reverse engineering
An AI coding assistant can propose a program from examples and revise it after a failing check. The useful loop is observe → propose → compare → revise. A convincing explanation is still a guess until its behavior is checked.
This arcade was built with AI assistance under Jonathan Simone's direction. Its reference and candidate rules are authored teaching examples. Comparisons and beam paths really run in your browser; there is no live model or recorded AI reconstruction here.
Explore the idea and its limits
Different programs can match the same examples. A counterexample is an input where a candidate and reference disagree. Exhaustive checking here covers a tiny declared domain and one output, the outgoing direction. It is not a claim about arbitrary inputs, commercial games or general AI reliability. Client source is inspectable; the reveal is a teaching device.
- Armando Solar-Lezama: counterexample-guided synthesis
- LLM4Decompile: reconstructing code
- When LLM Decompilers Recompile More and Preserve Less
Interaction inspiration: Bret Victor's Ladder of Abstraction and Nicky Case's Evolution of Trust. Arcade artwork and rules are original. No assets or code from those works are reused.