,
Aaron Williams
Creative Commons Attribution 4.0 International license
We investigate solutions to the new "Ziggu" family of sequential puzzles including Ziggurat, Zigguflat, Zigguhooked and so on. These puzzles have p pieces that form m mazes. We encode the state of each puzzle as a quaternary number (i.e., base 4) with n = m+1 digits, where each digit gives the horizontal or vertical position in one maze. For example, the commercial version of Zigguflat has p = 6 pieces connected into m = 4 mazes and its state requires n = 5 digits to describe. We show that the number of states on a shortest solution is 6 ⋅ 2ⁿ - 3n - 5 (Oeis A101946). There is only one solution of this length, and it is generated from the start configuration by a simple algorithm: make the leftmost modification that doesn't undo the previous modification. Replacing "leftmost" with "rightmost" instead generates the unique longest solution that visits all (3^{n+1} - 1)/2 states (Oeis A003462). In this way, Ziggu puzzles can be viewed as 4-ary, 3-ary, or 2-ary puzzles based on how the number of state encodings, valid states, or minimum states grow with each additional maze.
Classic Gray code puzzles (e.g., Spin-Out) provide natural and illuminating comparisons. These puzzles with p pieces typically have 2^p (Oeis A000079) or ⌊ 2/3 ⋅ 2^p ⌋ (Oeis A000975 [Stockmeyer, 2017]) states on their unique (shortest) solution, and at most one modification doesn't undo the previous modification. The states visited in a Gray code puzzle solution follow the well-known binary reflected Gray code. We show that Ziggu puzzles instead follow the quaternary reflected Gray code. More specifically, the shortest and longest solutions are both sublists of this order, meaning that some quaternary words are skipped over but the relative order of the remaining words does not change.
These results show how to solve Ziggu puzzles from the start configuration. To help solve the puzzle from an arbitrary configuration we provide O(n)-time comparison, and successor algorithms, which give the relative order of two states and the next state, respectively. While Gray code puzzles have simpler recursive descriptions and successor rules, a Ziggu puzzle has a much simpler loopless algorithm to generate its shortest solution than the Gray code puzzles do. The two families are also intimately related as they have the same comparison function.
@InProceedings{goertz_et_al:LIPIcs.FUN.2026.22,
author = {Goertz, Madeleine and Williams, Aaron},
title = {{The Quaternary Gray Code and Ziggu Puzzles}},
booktitle = {13th International Conference on Fun with Algorithms (FUN 2026)},
pages = {22:1--22:22},
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.22},
URN = {urn:nbn:de:0030-drops-257413},
doi = {10.4230/LIPIcs.FUN.2026.22},
annote = {Keywords: Puzzle, Ziggu, Ziggurat, Zigguflat, Gray Code, Loopless Algorithm}
}