This program solves, in real time, color puzzles (3-monitor) and triangle puzzles (maze) from The Witness challenge.
I tried to keep it as simple as possible, so there are no dependencies or external libraries—just standard Java library classes.
The program takes two parameters: the folder where Steam saves screenshots for The Witness, and the output folder where solved puzzles will be saved.
While running, it checks every second for a new screenshot. If one is found, it tries to detect and solve the puzzle.
Build:
javac Solver.java
Run:
java -Xss64m -cp . Solver "STEAM\\SCREENSHOT\\DIRECTORY\\" "OUTPUT\\DIRECTORY\\"
Use double backslashes in your paths.
The program runs in an infinite loop, so stop it manually when you're finished.
When taking a screenshot, try to align your view directly with the puzzle. Avoid top-down views; the puzzle should appear roughly square.
For puzzle detection, I used DFS and basic statistical analysis. For solving - backtracking with DFS.