arXiv:2610.31100cs.AIOct 2026

Manuscript Offprint

arXiv:2610.31100

Solving Flood-It Puzzles: A Comparison of Tailored A* Search with Declarative Solver Approaches

Philipp von Manteuffel, Benjamin Blankertz

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Abstract

We present an optimized approach for finding minimal move sequences to solve Flood-It puzzles using A* search and compare it with approaches using SAT, Integer Programming, and Constraint Programming solvers. The performance of A* search is considerably improved by using an appropriate heuristic and sophisticated equivalences of game states to limit the search space. Each aspect is systematically evaluated, providing insights that generalize to other problems. By comparing the best variant of each approach, the A* search is the fastest in finding a minimal solution in about 75% of the Flood-It instances tested. This result is in line with our expectation since A* specifically looks for a minimum solution. In contrast, the SAT-based approach is designed to solve the decision problem of whether a solution with a given length exists. An iterative search is required to determine a minimum solution length using a SAT-based approach. However, with increasing complexity, quantified by the minimum solution length, the SAT-based approach outperforms A*. We also compared the different approaches to the decision problem, where A* again performed best for the largest number of puzzles. Here, again, SAT supersedes A* for higher complexities, albeit with a lower crossing point.

1 Introduction

Flood-It is a combinatorial puzzle game played on an undirected colored graph G=(V,E)G = (V, E). Given a pivot element p∈Vp \in V, the goal of the game is to turn the graph monochromatic with the smallest possible number of moves. A move consists of choosing a color and recoloring the monochromatic component of GG that contains pp with the chosen color. So, the game can be thought of as a series of flood-filling operations, where the monochromatic component that contains pp is considered to be the set of flooded vertices. The game is often played on a square n×nn \times n board where the top left cell is the pivot element, and the player is asked to solve it within a given number of moves, see Fig. 1.

Figure

Figure 1: A 3×33 \times 3 Flood-It board on which a sequence of 4 moves is played that solves the board.

Finding some solution to a Flood-It instance is trivial: Choosing any 'playable' color, that is, a color of a cell that is adjacent to the flooded region, increases the number of flooded cells. Playing an arbitrary sequence of playable colors will result in a completely flooded graph in a number of moves that is less than the number of vertices of the graph.

In this paper, we consider the following two problems:

• Decision Problem: Given a Flood-It instance and an integer T, decide whether there is a solution in at most T moves (and provide such a solution).

• Minimization Problem: Given a Flood-It instance, determine the minimum number of moves required to solve it (and provide such a solution).

Finding a shortest solution is trivial for instances with just two colors. In this case, there is only one playable move at each step. But already for three colors, the Flood-It decision problem is in general NP-complete and the minimization problem is NP-hard in the size of the graph, see [Lagoutte et al., 2014] which also discusses certain edge cases that are not NP-hard.