Spider Solitaire is NP-Complete

Spider Solitaire 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.

This project investigates the potential of computers to solve complex tasks such as games. The paper proves that the complexity of a generalized version of spider solitaire is NP-Complete and uses much of structure of the proof that FreeCell is NP-Hard in the paper Helmert, M. “Complexity Results for Standard Benchmark Domains in Planning.” Artificial Intelligence 143.2 (2003): 219-62. Print. A given decision problem falls in to the class NP-Complete if it is proven to be both in NP and in NP-Hard. To prove that this is the case the paper shows that, not only do the kinds of possible moves that can be reversed prove this, but it is also shown that no spider solitaire game of size n will take more than a polynomial number of moves to complete if such a completion is possible. The paper reduces 3-SAT to SpiderSolitaire (the name used throughout the proof when referring to the generalized version of popular solitaire variant “Spider Solitaire”) by showing that any 3-SAT instance can be replicated using an appropriately arranged initial tableau. The example provided reinforces the proof of NP-Hardness and helps to make the proof easier to understand, but the definitive proof lies in the equations providing instruction on how to set up any 3-SAT instance of clause size C as a instance of SpiderSolitaire.


💡 Research Summary

The paper establishes that a generalized version of Spider Solitaire is NP‑Complete. It begins by formalizing the game’s rules: a standard Spider Solitaire uses two full decks (104 cards) with four suits, initially dealt into ten tableau piles (four piles of five cards and six piles of four cards). Cards can be moved only as descending sequences of the same suit, only the top card of each pile is face‑up, and a move may consist of a single card or a contiguous sequence. The objective is to remove all cards by forming complete suit‑ordered sequences.

To analyze the problem computationally, the authors define the n‑deck Cₙ = 2({♠,♣,♡,♢}) × {1,…,n} and introduce the notion of an n‑w‑tableau, a collection of at most w non‑empty sequences that together contain each card exactly once. A game state is a pair (T, U) where T is the current tableau and U denotes cards already removed. Two primitive operations, pickup and drop, are rigorously described for four cases each (empty vs. non‑empty tableau, single card vs. same‑suit sequence). All legal moves are expressed as compositions drop ∘ pickup.

Membership in NP is proved by showing that any “non‑undoable” move—either moving a card onto a non‑matching buried part or completing a full suit sequence—can occur only a bounded number of times. Since the initial tableau and any deck contain O(n) cards, each card can block at most one other card, leading to a worst‑case bound of 64 n² − 72 n + 8 moves. Consequently, a candidate solution can be verified in polynomial time, placing the decision problem in NP.

NP‑Hardness is demonstrated via a polynomial‑time reduction from 3‑SAT. Given a 3‑SAT instance with variables V = {v₁,…,vₙ} and clauses C = {c₁,…,cₘ}, the construction creates several groups of tableau piles:

  1. Literal selection piles – one for each literal (vᵢ or ¬vᵢ). Each pile contains three cards whose values encode the literal’s index and a global “selection value” valₛ. The top cards are specially valued spade cards that become “choice cards” when the corresponding literal is set to true.

  2. Clause groups – for each clause, six piles are built. The first three piles each hold four cards; the fourth pile holds a single card. Their values are derived from global parameters val_B (bottom value) and val_C (clause value) together with the occurrence order of literals in the clause. The construction guarantees that a clause’s fourth pile can be cleared only if at least one of its three literals has its choice card exposed.

  3. Foundation piles – eight piles each containing a single high‑value card (val_F) of each suit; they serve as the final destination for all cards once the logical part of the game is resolved.

  4. Big pile – a large reservoir of cards with values just below the maximum; these cards cannot be moved until the clause‑group fourth piles are emptied, forcing the logical structure to be respected before any “extra” cards can be dealt with.

The reduction assigns numeric values to cards using formulas such as valₖ = valₛ + 2k + 2 oₖ, where oₖ counts occurrences of literal ℓₖ. These values enforce a strict ordering: cards must be moved in increasing numeric order, mirroring the logical dependencies of the SAT instance.

If the 3‑SAT formula is satisfiable, a winning strategy exists: for each true literal, move its two top cards from the corresponding literal selection pile onto the first selection pile, exposing the choice card. This choice card then enables the removal of the top two cards of one of the three clause piles associated with each satisfied clause. After all clauses have been satisfied, the remaining high‑value cards can be transferred to the foundation piles in order, completing the game.

Conversely, if the Spider Solitaire instance can be solved, the forced movement pattern forces the player to expose exactly one choice card per variable, and to clear each clause’s fourth pile the player must have previously uncovered a choice card corresponding to a satisfied literal. Hence a satisfying assignment can be extracted from any successful play, establishing the correctness of the reduction.

The authors note that the same construction works when the deck height is non‑zero by requiring all deck cards to be moved to the foundations, simply adjusting the suit length accordingly.

Having shown both NP membership and NP‑Hardness, the paper concludes that generalized Spider Solitaire is NP‑Complete. This result parallels earlier proofs for FreeCell but adapts the reduction to Spider Solitaire’s unique mechanics—particularly the requirement to build complete suit sequences before removal. The work contributes a new benchmark problem to computational complexity theory and offers insights for AI planning, automated puzzle generation, and the theoretical analysis of card games.


Comments & Academic Discussion

Loading comments...

Leave a Comment