Papers
Topics
Authors
Recent
Search
2000 character limit reached

The Optimal Knight Exchange Puzzle is NP-Hard

Published 28 Jun 2026 in cs.DM and cs.CC | (2606.29153v1)

Abstract: This paper explores the hardness of two popular recreational chess puzzles: The Knight's Tour and the Knight Exchange (Swap). The problem of finding a Knight's Tour is known to be NP-hard for any chessboard with holes and constant-time decidable for rectangular chessboards, so a natural direction is to explore the hardness of the problem for intermediate chessboard restrictions. In this paper, we show that Knight's Tour is NP-hard for connected boards. We also give a short polynomial-time reduction between the two problems, showing that the optimality version of Knight Exchange is NP-hard.

Authors (1)

Summary

  • The paper establishes that both open and closed Knight’s Tour and optimal Knight Exchange puzzles are NP-hard on connected chessboards with holes.
  • It employs novel gadget constructions and reductions from Hamiltonian Cycle in bipartite graphs to reveal the problem’s computational intractability.
  • These results have significant implications for algorithm design in combinatorial puzzles, multi-agent path finding, and game content generation.

NP-Hardness of the Optimal Knight Exchange Puzzle

Problem Formulation and Context

The paper "The Optimal Knight Exchange Puzzle is NP-Hard" (2606.29153) establishes the computational intractability of two interrelated problems in the domain of combinatorial chess puzzles: the Knight's Tour and the Knight Exchange puzzles, when restricted to general connected chessboards (with holes). Specifically, it shows:

  • Both open and closed versions of the Knight's Tour (Hamiltonian path/cycle on the knight's move graph) are NP-hard for connected chessboards.
  • The optimal version of the Knight Exchange problem—minimizing the sequence of moves to swap black/white knights—on such boards is also NP-hard.

These results address and resolve prominent open questions on the algorithmic complexity of these puzzles in settings that interpolate between well-studied polynomial and NP-hard regimes. The analysis leverages a blend of classical reductions and novel construction techniques grounded in graph theory.

Connection to Pebble Motion and Hamiltonicity

The Knight Exchange is formalized as a colored pebble motion problem on bipartite graphs induced by the knight's move relation. The feasibility variant (existence of any sequence of moves to achieve the exchange) is tractable, but the optimality variant, where the length of the swap sequence is minimized, is shown in this paper to be NP-hard.

A polynomial-time reduction from Hamiltonian Cycle in bipartite graphs to this pebble swap problem on bipartite graphs is presented, leveraging the close correspondence between Hamiltonicity and optimal swap plans. This reduction is then transported to the "chess world" by translating grid graphs to so-called knight's boards with holes, ensuring key structural properties are maintained.

Figure 1

Figure 2: A grid graph and its corresponding construction, where each node is mapped to a 9×9 chessboard with holes, encoding adjacency and connectivity in the knight's move graph.

Technical Constructions and Key Reductions

The reduction from Hamiltonian Cycle to the pebble swap problem, and from there to the Knight's Tour and Knight Exchange, makes use of "gadgets": specific 9×9 chessboard fragments, representing the vertices and edges of an arbitrary grid subgraph. Each such gadget supports controlled entry and exit (the so-called "transition squares"), and the global construction guarantees that only legitimate knight's moves—according to the embedding of the original grid—permit crossing between gadgets.

Notably, all transition squares used for inter-gadget traversal are assigned the same color, which is guaranteed to be the color in majority by +1, ensuring parity constraints crucial to the proof.

Figure 1

Figure 3: Chessboard gadgets encode vertex and edge structure with carefully placed holes and transition squares, admitting knight's moves only where permissible.

The constructions ensure that any solution to the composite Knight's Tour (open or closed) on the overall board corresponds to a Hamiltonian path/cycle in the base grid graph, and vice versa. Thus, the NP-hardness of Hamiltonian Cycle in grid graphs (and more generally, bipartite graphs) translates to NP-hardness for the Knight's Tour on these connectable boards.

This approach is extended to prove the NP-hardness of optimal Knight Exchange: the reduction exploits the ability to augment certain gadgets (those at boundary positions) to accommodate the necessary configuration extensions for the pebble swap reduction.

Figure 4

Figure 4

Figure 5: Extension mechanism for boundary chessboards to enable necessary connections and isolated squares in the Knight Exchange reduction.

Main Theoretical Results

The principal theorems established are:

  • NP-Hardness of Knight's Tour on Connected Boards: Both open and closed variants are NP-hard for boards constructed via the described embedding.
  • NP-Hardness of Optimal Knight Exchange: The minimization variant is NP-hard, even though the feasibility variant is polynomial-time decidable.

The reduction methodology is robust and provides explicit constructions, mapping any given instance of grid graph Hamiltonicity to an equivalent instance of the chessboard puzzle problem in polynomial time.

Implications and Future Directions

The paper closes a gap between previously tractable and intractable cases for the Knight's Tour and Knight Exchange puzzles. Prior work classified rectangular, hole-less boards as polynomial but left ambiguous the case for arbitrary connected boards with holes, except for general undecidable types.

The results have several important implications:

  • Algorithmic barriers: Generic search or planning algorithms are necessarily exponential in the worst case for these settings, invalidating the possibility of efficient universal heuristics.
  • Connection to Multi-Agent Path Finding (MAPF): The reductions and structural insights inform MAPF hardness results, particularly in grid environments and with color/swap constraints.
  • Design of puzzle generators and solvers: The complexity landscape mapped here guides the construction of challenging instances for recreational puzzles, game content, or AI benchmarks.
  • Extension to other chess-piece puzzles: Similar embedding and reduction principles could be adapted for puzzles involving other chess pieces with non-trivial movement graphs.

Further research may explore approximation guarantees for the optimal knight exchange, fixed-parameter tractable instances (e.g., for bounded holes or board shapes), or the development of practical solver strategies exploiting specific board symmetries.

Conclusion

This paper rigorously establishes the NP-hardness of both the Knight's Tour and the optimal Knight Exchange on arbitrary connected chessboards with holes, leveraging tight polynomial-time reductions and gadget constructions that encode arbitrary grid graphs into the knight's move framework. The findings elucidate the computational boundaries for these classical puzzles and deepen the interplay between combinatorial game theory and computational complexity.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.