Screens for Hearts and peg solitaire, and a seat for one

Both engines had been sitting behind ids with no screen. This gives them one
each and puts them in the catalogue.

Peg solitaire is the first game here played alone, and almost nothing had to
move for it. seatCountFor already fell through to minPlayers, so one seat came
free; CatalogTest's floor of two players is the only invariant that had to go,
and it went to one. The setup screen grows a solo path instead: a one-seat game
has nobody to play against and no seat anyone could join, so it offers "Play"
and not "Host a game for others to join", and the menu says "On your own"
rather than "1 players".

Playing again cannot go through advanceIdle. driveIdleSeats returns the moment
rules.isFinished is true, before it ever reaches the confirmation branch, and a
peg board with no jumps left genuinely is finished -- unlike a Wizard round,
which is only between deals. Rather than bend isFinished into meaning something
else, the screen rebuilds the controller behind a generation counter. The board
is deterministic, so the retry is the same puzzle rather than a new one.

One board layout serves both geometries. Each hole is placed in hole-widths
rather than pixels and a triangle offsets its rows by half a hole, which is the
same staggering that gives a triangular hole six neighbours instead of four.

The Hearts screen reads the phase because two different things happen at it:
choosing three cards to give away, which is a multiple selection nothing else
in the app does, and then playing one card at a time like every other trick
screen here. Passing is capped at three by the picker rather than by the error
the rules would otherwise raise.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Urn6eEBA6XzrnfoibL7faC
This commit is contained in:
Claude
2026-08-08 14:13:10 +00:00
parent 51aa0c3518
commit 434ea86605
7 changed files with 693 additions and 22 deletions
@@ -41,12 +41,6 @@ object GameCatalog {
* [all] when its screen lands.
*/
const val HEARTS = "hearts"
/**
* Peg solitaire, likewise an id ahead of its screen. It is also the first
* game here played by one person, so it arrives with the seat-count change
* that allows it rather than before it.
*/
const val PEG_SOLITAIRE = "pegsolitaire"
const val SEQUENCE = "sequence"
const val MASTERMIND = "mastermind"
@@ -130,6 +124,17 @@ object GameCatalog {
"twice round the board to 121.",
available = true,
),
GameDescriptor(
id = HEARTS,
title = "Hearts",
category = GameCategory.CARD,
minPlayers = 4,
maxPlayers = 4,
teamBased = false,
blurb = "Take no trick worth taking. Every heart costs a point, the queen " +
"of spades costs thirteen, and taking all of them costs everybody else.",
available = true,
),
GameDescriptor(
id = SEQUENCE,
title = "Sequence",
@@ -191,6 +196,19 @@ object GameCatalog {
blurb = "Three in a row takes a piece. Reduce them to two and the game is yours.",
available = true,
),
GameDescriptor(
id = PEG_SOLITAIRE,
title = "Peg Solitaire",
category = GameCategory.BOARD,
// The first game here played alone. Everything downstream reads the
// seat count from these two numbers, so one seat is all it takes.
minPlayers = 1,
maxPlayers = 1,
teamBased = false,
blurb = "The tee game from the table, and four larger boards. Jump a peg, " +
"take the one you passed, and try to finish with one standing.",
available = true,
),
GameDescriptor(
id = PIRATES,
title = "Pirates and Bulgars",