Zen Puzzle Garden is NP-complete

Zen Puzzle Garden is NP-complete
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

Zen Puzzle Garden (ZPG) is a one-player puzzle game. In this paper, we prove that deciding the solvability of ZPG is NP-complete.


💡 Research Summary

Zen Puzzle Garden (ZPG) is a popular single‑player puzzle in which the player controls a character moving on a rectangular grid composed of water, rock, and grass tiles. The character may start on a designated water tile and must traverse only water tiles, moving in straight lines, while stepping on every grass tile exactly once. Rocks are impassable, and once a water tile has been left the player cannot return to it, enforcing a one‑way flow. Formally, given a grid layout and a start cell, the decision problem asks whether there exists a path that visits each grass cell exactly once while respecting the movement constraints.

The paper first establishes that the problem belongs to NP. A candidate solution is simply the sequence of moves (or the list of visited cells). Verification consists of scanning the sequence, checking at each step that the move stays on water, respects the one‑way rule, does not step on a rock, and that each grass cell appears exactly once. This can be done in time linear in the size of the grid, so the problem is in NP.

To prove NP‑hardness, the authors reduce the classic Hamiltonian‑Path problem (known to be NP‑complete) to ZPG. The reduction is built around a set of carefully designed “gadgets” that simulate graph vertices and edges within the ZPG grid. Four basic gadget types are introduced:

  1. Vertex gadget – a cross‑shaped arrangement of water and grass that permits entry from any of the four cardinal directions but forces a unique exit direction, thereby encoding the choice of which incident edge to follow.
  2. Edge gadget – a corridor of water tiles that can be traversed only once in a single direction; after the player leaves it, the one‑way rule prevents re‑entry, mirroring the “use‑once” property of edges in a Hamiltonian path.
  3. Turn gadget – a short segment that bends the direction of travel, allowing the planar embedding of arbitrary graph layouts.
  4. Start/finish gadget – a specially marked water tile that serves as the initial position of the character.

Given an arbitrary undirected graph G = (V, E), the reduction replaces each vertex v ∈ V with a vertex gadget and each edge (u, v) ∈ E with an edge gadget connecting the corresponding vertex gadgets. Turn gadgets are inserted as needed to keep the construction planar and to fit within a rectangular grid. The size of the resulting ZPG instance is O(|V| + |E|), i.e., polynomial in the size of G, and the construction can be carried out in polynomial time.

Correctness of the reduction is proved in two directions. If G has a Hamiltonian path, then by following that path the player can enter each vertex gadget, traverse the appropriate edge gadget, and ultimately visit every grass tile exactly once, because each vertex gadget contains a unique grass tile that is visited when the gadget is entered, and each edge gadget’s water corridor is traversed exactly once. Conversely, any solution to the ZPG instance must respect the forced entry/exit behavior of the vertex gadgets and the one‑way nature of the edge gadgets; thus the sequence of visited gadgets corresponds to a Hamiltonian path in G. The authors provide exhaustive case analyses of the internal movement possibilities of each gadget, confirming that no unintended shortcuts or back‑tracking are possible.

Since the reduction is polynomial and Hamiltonian Path is NP‑complete, ZPG is NP‑hard. Combined with the earlier membership proof, ZPG is therefore NP‑complete. The paper concludes by discussing the broader implications: ZPG joins a growing list of seemingly simple recreational puzzles that are computationally intractable, and the gadget‑based reduction technique offers a template for analyzing the complexity of other grid‑based games. This result is of interest both to game designers, who gain insight into the inherent difficulty of puzzle creation, and to theoretical computer scientists, who acquire a new natural problem that captures the essence of NP‑completeness.


Comments & Academic Discussion

Loading comments...

Leave a Comment