Table of Contents
Fetching ...

Computational Complexity of Swish

Takashi Horiyama, Takehiro Ito, Jun Kawahara, Shin-ichi Minato, Akira Suzuki, Ryuhei Uehara, Yutaro Yamaguchi

TL;DR

The paper resolves the open case of Swish with two symbols per card by showing polynomial-time solvability when no flips or rotations are allowed and NP-completeness when any transformation is allowed; it also extends NP-hardness to the full-Swish setting and to the rotation-only variant. The key technique for the tractable case is a reduction to a maximum-weight perfect matching on a bipartite graph, yielding a polynomial-time algorithm with complexity comparable to classic matching algorithms. Together with prior results for other symbol counts, the work provides a complete classification of Swish complexity across two axes: number of symbols per card and admissible symmetries, revealing a sharp boundary between tractable and intractable variants. The findings have implications for understanding the combinatorial structure of Swish and for evaluating the computational complexity of similar overlay puzzles in games and puzzles.

Abstract

Swish is a card game in which players are given cards having symbols (hoops and balls), and find a valid superposition of cards, called a "swish." Dailly, Lafourcade, and Marcadet (FUN 2024) studied a generalized version of Swish and showed that the problem is solvable in polynomial time with one symbol per card, while it is NP-complete with three or more symbols per card. In this paper, we resolve the previously open case of two symbols per card, which corresponds to the original game. We show that Swish is NP-complete for this case. Specifically, we prove the NP-hardness when the allowed transformations of cards are restricted to a single (horizontal or vertical) flip or 180-degree rotation, and extend the results to the original setting allowing all three transformations. In contrast, when neither transformation is allowed, we present a polynomial-time algorithm. Combining known and our results, we establish a complete characterization of the computational complexity of Swish with respect to both the number of symbols per card and the allowed transformations.

Computational Complexity of Swish

TL;DR

The paper resolves the open case of Swish with two symbols per card by showing polynomial-time solvability when no flips or rotations are allowed and NP-completeness when any transformation is allowed; it also extends NP-hardness to the full-Swish setting and to the rotation-only variant. The key technique for the tractable case is a reduction to a maximum-weight perfect matching on a bipartite graph, yielding a polynomial-time algorithm with complexity comparable to classic matching algorithms. Together with prior results for other symbol counts, the work provides a complete classification of Swish complexity across two axes: number of symbols per card and admissible symmetries, revealing a sharp boundary between tractable and intractable variants. The findings have implications for understanding the combinatorial structure of Swish and for evaluating the computational complexity of similar overlay puzzles in games and puzzles.

Abstract

Swish is a card game in which players are given cards having symbols (hoops and balls), and find a valid superposition of cards, called a "swish." Dailly, Lafourcade, and Marcadet (FUN 2024) studied a generalized version of Swish and showed that the problem is solvable in polynomial time with one symbol per card, while it is NP-complete with three or more symbols per card. In this paper, we resolve the previously open case of two symbols per card, which corresponds to the original game. We show that Swish is NP-complete for this case. Specifically, we prove the NP-hardness when the allowed transformations of cards are restricted to a single (horizontal or vertical) flip or 180-degree rotation, and extend the results to the original setting allowing all three transformations. In contrast, when neither transformation is allowed, we present a polynomial-time algorithm. Combining known and our results, we establish a complete characterization of the computational complexity of Swish with respect to both the number of symbols per card and the allowed transformations.
Paper Structure (9 sections, 3 theorems, 5 figures)

This paper contains 9 sections, 3 theorems, 5 figures.

Key Result

Theorem 1

Swish without Flip or Rotation is solved in polynomial time.

Figures (5)

  • Figure 1: Example of cards in Swish. Following the notation introduced in Section \ref{['sec:2_1_swish']}, $c_1 = ((1, 1), (1, 3))$, $c_2 = ((1, 3), (2, 1))$, etc. The swishes of this instance without rotation or flip are $\{c_1, c_2, c_3\}$, $\{c_5, c_6\}$, and $\{c_1, c_2, c_3, c_5, c_6\}$. If we are allowed both flip and rotation, $\{c_2, c_3, c_6\}$ is also a swish, where we use the cards as $c_2 = ((1, 3), (2, 1))$, ${c}^\mathrm{F}_3 = ((2, 3), (1, 3))$, and ${c}^\mathrm{R}_6 = ((2, 1), (2, 3))$, where the superscripts $\mathrm{F}$ and $\mathrm{R}$ mean horizontal flip and $180$-degree rortaion, respectively.
  • Figure 2: Bipartite graph $G = (V^+, V^-; E)$ constructed from the Swish instance in Figure \ref{['fig:swish']}. $\{e_{c_1}, e_{c_2}, e_{c_3}\} \cup \{\, f_p = \{p^+, p^-\} \mid p \in V \setminus \{(1, 1), (1, 3), (2, 1)\} \,\}$ is a perfect matching, which corresponds to swish $\{c_1, c_2, c_3\}$ without rotation or flip. The weight of this perfect matching is $3$, which is equal to the size of the corresponding swish.
  • Figure 3: Example of an instance (left) and its solution (right) of $\forall$Even Dicycle-Factor.
  • Figure 4: The set of cards created from the instance of $\forall$Even Dicycle-Factor in Figure \ref{['fig:even_cycle_factor']}, where we omit $f_{v_i, j}$ for $i = 3, 4, 5, 6$ (they are analogous to $f_{v_1, j}$ and $f_{v_2, j}$).
  • Figure 5: The swish without rotation corresponding to the solution in Figure \ref{['fig:even_cycle_factor']}, where we omit $f_{v_i, j}$ for $i = 3, 4, 5, 6$.

Theorems & Definitions (8)

  • Theorem 1
  • Theorem 2
  • Claim 3
  • Remark 4
  • Remark 5
  • Theorem 6: bang2014archorsch2025odd
  • Claim 7
  • Remark 8