,
Orel Cosseron
Creative Commons Attribution 4.0 International license
A recursive maze is a maze that contains copies of itself (that themselves contain copies of themselves, etc.). To exit the maze or reach the goal, each recursive block that has been entered must be exited. These once-popular puzzles are difficult to solve by hand, and this begs for an algorithmic solution. It has been observed many times in the past that a recursive maze can be represented by a deterministic pushdown automaton. Finding a path, possibly the shortest, that leads to an exit therefore reduces to finding a word in a context-free language described by such an automaton. The problem is well-known to be decidable, and there is a classical algorithm for this task. We present a new algorithm, Midterm, with improved complexity compared to existing solutions. Midterm improves on a previous attempt called Longterm (Obviously Not a Good Technique to Exit Recursive Mazes).
@InProceedings{bouillaguet_et_al:LIPIcs.FUN.2026.9,
author = {Bouillaguet, Charles and Cosseron, Orel},
title = {{MIDTERM Is a Deterministic Technique to Exit Recursive Mazes}},
booktitle = {13th International Conference on Fun with Algorithms (FUN 2026)},
pages = {9:1--9:21},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-417-8},
ISSN = {1868-8969},
year = {2026},
volume = {366},
editor = {Iacono, John},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.FUN.2026.9},
URN = {urn:nbn:de:0030-drops-257280},
doi = {10.4230/LIPIcs.FUN.2026.9},
annote = {Keywords: Recursive maze, pushdown automaton, reachability, context-free grammar, graph rewriting}
}