From 5ca7dce7a06e679b609bbc301fede0a2c1eb7723 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Fri, 27 Nov 2026 16:04:53 -0700 Subject: [PATCH] Fix Three Shuffles and a Draw to start aces on foundations - Aces now begin on the four foundations; only the remaining 48 cards are dealt into fans, yielding 16 even fans of three instead of 17 fans plus a single. - Update engine comments, game blurb, and tutorial text to match the corrected rules. - Adjust verification checks to assert ace placement, 16 uniform fans, and 17-fan layout fit after a Draw. --- .pi/.goals-pool-snapshot.json | 1 + src/games/solitairetour/SolitaireTourLogic.js | 21 ++++++++++++------- src/games/solitairetour/tutorial.md | 2 +- tools/verifySolitaireTour.js | 9 ++++---- 4 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 .pi/.goals-pool-snapshot.json diff --git a/.pi/.goals-pool-snapshot.json b/.pi/.goals-pool-snapshot.json new file mode 100644 index 0000000..7672188 --- /dev/null +++ b/.pi/.goals-pool-snapshot.json @@ -0,0 +1 @@ +{"version":1,"dirMtimeMs":1795818542664.5647,"goals":[]} \ No newline at end of file diff --git a/src/games/solitairetour/SolitaireTourLogic.js b/src/games/solitairetour/SolitaireTourLogic.js index 9531944..57e981d 100644 --- a/src/games/solitairetour/SolitaireTourLogic.js +++ b/src/games/solitairetour/SolitaireTourLogic.js @@ -90,7 +90,7 @@ export const GAME_META = { }, threeshuffles: { name: 'Three Shuffles and a Draw', venue: 'Café de la Belle Lucie', place: 'Paris', greet: 'Greetings from Paris!', - blurb: 'Foundations build up by suit from Ace. Fans build down in suit; only the top card plays and empty spaces stay empty. Two reshuffles, then one Draw frees a buried card.', + blurb: 'Aces start on the foundations; the rest are dealt into fans. Fans build down in suit; only the top card plays and empty spaces stay empty. Two reshuffles, then one Draw frees a buried card.', }, }; @@ -353,11 +353,11 @@ export class KlondikeEngine { } // ── Three Shuffles and a Draw (a La Belle Lucie variant) ───────────────────── -// Four foundations build UP in suit from Ace. The tableau is dealt into fans of -// three (the last is short); fans build DOWN in suit and only the top card is in -// play. Empty spaces are never refilled. When stuck the player gathers all fan -// cards, shuffles, and redeals — twice (the initial deal is the first of the -// three "shuffles"). After the redeals are spent, one Draw frees any single +// The four aces start on the foundations; the remaining 48 cards are dealt into +// fans of three. Four foundations build UP in suit; fans build DOWN in suit and +// only the top card is in play. Empty spaces are never refilled. When stuck the +// player gathers all fan cards, shuffles, and redeals — twice (the initial deal +// is the first of the three "shuffles"). After the redeals are spent, one Draw frees any single // buried card. The reshuffle is seeded and the seed is part of the snapshot, // so undoing a shuffle and shuffling again gives the same cards. export class ThreeShufflesEngine { @@ -368,7 +368,12 @@ export class ThreeShufflesEngine { this.drawsLeft = 1; this.seed = seed >>> 0; this.moveCount = 0; - this.dealPiles(deck); + const rest = []; + for (const card of deck) { + if (card.pval === 1) this.foundations[card.suit].push(card); + else rest.push(card); + } + this.dealPiles(rest); } snapshot() { @@ -390,7 +395,7 @@ export class ThreeShufflesEngine { return ((t ^ (t >>> 14)) >>> 0) / 4294967296; } - /** Fans of three; the final fan holds the remainder (17 × 3 + 1 on the first deal). */ + /** Fans of three (48 dealable cards = 16 even fans). */ dealPiles(cards) { this.piles = []; for (let i = 0; i < cards.length; i += 3) this.piles.push(cards.slice(i, i + 3)); diff --git a/src/games/solitairetour/tutorial.md b/src/games/solitairetour/tutorial.md index f5f4ee0..04dded4 100644 --- a/src/games/solitairetour/tutorial.md +++ b/src/games/solitairetour/tutorial.md @@ -90,7 +90,7 @@ Twelve piles (four of five, eight of four). ### 5 · Three Shuffles and a Draw — the Café -The whole deck is dealt into **fans of three** (the last fan has one card), with four **foundations** above. +The four **aces start on the foundations**, and the remaining 48 cards are dealt into **fans of three**. - Foundations build **up by suit from Ace**. - Only the **top card of a fan** plays. Fans build **down in the same suit** (the 6♥ goes on the 7♥). diff --git a/tools/verifySolitaireTour.js b/tools/verifySolitaireTour.js index e6e79ba..ed118f4 100644 --- a/tools/verifySolitaireTour.js +++ b/tools/verifySolitaireTour.js @@ -144,7 +144,8 @@ section('Take Fourteen'); section('Three Shuffles and a Draw'); { const e = createEngine('threeshuffles', mulberry32(6)); - ok('17 fans of 3 + 1 single', e.piles.length === 18 && e.piles.slice(0, 17).every(p => p.length === 3) && e.piles[17].length === 1); + ok('aces start home', Object.values(e.foundations).every(f => f.length === 1 && f[0].pval === 1)); + ok('16 fans of 3', e.piles.length === 16 && e.piles.every(p => p.length === 3)); e.restore({ piles: [cs('9s 8s'), cs('7s'), cs('7h'), [], cs('As')], foundations: { s: [], h: [], d: [], c: [] }, shufflesLeft: 2, drawsLeft: 1, seed: 99, moveCount: 0 }); ok('builds down in suit', e.canStack(C('7s'), 0) && !e.canStack(C('7h'), 0)); ok('empty spaces stay empty', !e.canStack(C('7h'), 3)); @@ -313,12 +314,12 @@ section('Room layouts'); e.restore({ tableau: tab, stock: deck.slice(19), waste: [], foundations: { s: [], h: [], d: [], c: [] }, recyclesLeft: Infinity, moveCount: 0 }); const last = cardBounds(legFor(e).layout().get(tab[6][18].card.id).pose); ok('klondike: a 19-card column fits on the table', last.y1 <= PLAY.y1 + 1); - // Three Shuffles with 19 fans (after a Draw) still fits + // Three Shuffles with 17 fans (after a Draw) still fits const t = createEngine('threeshuffles', mulberry32(3)); t.shufflesLeft = 0; t.apply({ t: 'tdraw', id: t.piles[0][0].id }); - const ok19 = [...legFor(t).layout().values()].every(v => cardBounds(v.pose).y1 <= PLAY.y1); - ok('three: 19 fans fit', t.piles.length === 19 && ok19); + const ok17 = [...legFor(t).layout().values()].every(v => cardBounds(v.pose).y1 <= PLAY.y1); + ok('three: 17 fans fit', t.piles.length === 17 && ok17); // the map has every stop on it ok('route map has all five stops inside it', TOUR.every(l => { const p = mapXY(STOPS[l].lon, STOPS[l].lat); return p.x > 0 && p.x < MAP.w && p.y > 0 && p.y < MAP.h; })); ok('every leg has a room theme', TOUR.every(l => THEMES[l]?.surface && THEMES[l].life));