Every move keeps all 104 cards

A Jack of Hearts can land on a Queen of Spades without making the mixed pair movable together. This Spider Solitaire JavaScript prototype keeps pickup validation separate from destination validation, then accounts for every card even when a completed run leaves the tableau.

Play a deterministic two-suit Spider game starting with 54 cards in ten columns and 50 in stock. It supports face-up suffix selection, explicit destinations, atomic ten-card deals, completed-run storage, Undo and Reset. Separate one-run and two-run demonstrations leave 91 tableau cards plus 13 completed cards, or 78 plus 26. Every state retains 104 unique card IDs.

Every move keeps all104 cards
Every move keeps all104 cards
Open the full example ↗

Declare one deck and one deal convention

Use eight sets numbered 0–7, each with ranks 1–13, where Ace=1 and King=13. Even-numbered sets are Spades and odd sets are Hearts: four sets of each, 52 cards per suit, 104 total.

Every card has a unique set-rank ID, suit, rank and face-up state. A second Spade Queen is a different ID, not another reference to the first Queen object.

The chosen author tutorial uses ten columns, 54 initially dealt cards and 50 stock cards. This game uses the same 54/50 card counts. HinaTech: Spider Development Tutorial

Bicycle's published rules also distinguish suited movable units from a next-higher-rank destination, but describe a different initial deal and final partial stock deal. This model retains the declared 54/50 convention; it does not mix the variants. Bicycle: Spider Solitaire

Build the sample deck in order: set 0 ranks 1–13, then set 1, continuing through set 7. Deal sequentially into column 0's six cards, then columns 1–3 six each, then columns 4–9 five each. Only each column's last card is face up. Remaining cards retain their order as the stock.

Initial partition Count
Columns 0–3 4 × 6 = 24
Columns 4–9 6 × 5 = 30
Tableau total 54
Stock 50
Completed cards 0
All unique IDs 104

Top means the last array entry, not the highest card drawn on screen. This sample is not shuffled and is not claimed winnable.

Validate the entire movable suffix

A selected card can start a movable suffix only if it and every card after it are face up, in the same suit and consecutive descending ranks. The suffix extends to the column's last entry; it cannot skip a card.

For example, Queen of Spades followed by Jack of Spades is a valid two-card suffix. Queen of Spades followed by Jack of Hearts is not valid as a two-card suffix, despite their consecutive ranks. Queen of Spades followed by Ten of Spades fails because of the rank gap.

A single face-up Jack of Hearts at the top is a valid one-card suffix. Being unable to move a mixed pair does not prevent moving its exposed last card alone.

The completion demonstrations are separate from the initial deal.

Apply a different rule to the destination

For a nonempty destination, its top card must be face up and one rank higher than the selected suffix's leading card. Suit does not restrict this drop.

Thus the valid Queen-Jack of Spades suffix can land on a King of Hearts. The resulting mixed-suit boundary does not make the whole King-Queen-Jack stack movable as one suffix.

A single Jack of Hearts can land on a face-up Queen of Spades. Empty destinations accept any already-valid movable suffix, including a King-led one. Moving to the same source column is rejected as a no-op.

Validate pickup and destination against the same pre-action state. Transfer the complete suffix once, preserving IDs and face states. If a face-down card becomes the source's new top, flip it once. Invalid actions change no pile, card, counter or Undo history.

Deal and preserve completed cards

Deal stock first checks that all ten columns are nonempty and at least ten stock cards remain. It moves exactly one card to each column, all face up. An empty column or short stock rejects the whole action before any card moves. This 54/50 model has five complete stock batches, not a final partial deal.

A completed top suffix must contain 13 face-up cards in one suit, descending King through Ace. The game transfers those cards into a stored completed list, flips any newly exposed top, and checks again. It does not delete their IDs. Win requires eight stored complete runs and a valid 104-card partition.

The staged inspection buttons create the declared controlled states, not positions claimed reachable from the initial deal. Resolve staged runs uses the same completion detector. One run leaves 91 tableau cards and 13 stored; two leave 78 and 26. Unused cards remain distributed once among the other columns.

Undo restores the complete pre-action snapshot, including card order, face states, stock and stored runs. Invalid moves create no history. Reset restores the exact deterministic deal rather than shuffling. This fixed deal has no winnability guarantee. Face-down cards remain readable in the page's JavaScript state, so hiding them on screen does not make their identities secret.

Copy a prompt for this example

Create one self-contained HTML deterministic two-suit Spider game with embedded CSS and JavaScript. Use readable card buttons in ten columns, destination buttons, a stock control, Undo, Reset, and visible card totals. Reflow columns on small screens.

Create 104 unique cards: sets 0 through 7, each with ranks 1 through 13. Even sets are Spades and odd sets Hearts. Order the deck by set, then ascending rank. Deal six consecutive cards to each of columns 0 through 3 and five to columns 4 through 9. Only each column's final card is face up. Keep 50 cards in stock.

A selected suffix is movable only when every card is face up, in one suit, and consecutively descending. A destination may be empty or end in a face-up card one rank higher than the suffix's leading card, regardless of suit. Reject same-column moves. Flip the newly exposed source top after a valid transfer.

Deal one face-up stock card to every column only when all ten columns are nonempty and at least ten stock cards remain. Store completed same-suit King-through-Ace runs with all their IDs. Repeat detection after exposing a new top.

After rebuilding the tableau, restore focus to the replacement control with the same ID, or a sensible destination fallback. Undo restores a complete pre-action snapshot. Invalid actions create no history. Reset restores the fixed deal. For controlled demonstrations, put hidden card 6-7 first in column 0, followed by set 0 in descending King-through-Ace order. The two-run version places a descending set 2 run between that hidden card and set 0. Distribute every unused card round-robin among columns 1 through 9, expose each column's top, and leave stock empty. Resolving them leaves 91 plus 13 or 78 plus 26 tableau/completed cards. Preserve 104 unique IDs throughout and win only with eight completed runs. Return only the complete HTML file.

For a state-conservation review, NOS can display this prepared HTML Spider prototype. Deal ten cards, undo the action, then resolve the staged two-run case and inspect all 26 stored IDs before changing the card-transfer logic.

Keep reading