Add app shell with Euchre and Sequence, LAN/Bluetooth play

First vertical slice: the whole shell plus two games playable end to end,
so every layer is exercised before the other nine games are built on it.

Games
- Euchre: bowers, ordering up, dealer discard, going alone, stick the
  dealer, and full scoring. Rule variants (deck size, points to win,
  stick the dealer, going alone) are toggles in game setup.
- Sequence: two-eyed and one-eyed jacks, free corners, locked sequences,
  the shared-chip limit, and dead-card exchange. Teams, players per team
  and the sequence target are toggles.
- The board layout in SequenceBoard is generated, not the commercial
  board — it holds every structural property the rules need, but does not
  match a physical board. Documented in docs/RULES-sequence.md.

Multiplayer
- One transport abstraction over newline-delimited JSON, implemented
  twice: LAN via NSD discovery and TCP, Bluetooth via Classic RFCOMM.
  A lobby advertises on both at once, so a table can mix them.
- Host-authoritative: clients send move intents, the host re-validates
  every one against the rules, and each client receives a state redacted
  for its own seat so hidden information never crosses the wire.
- Seats start as AI and are handed to people as they join, which is what
  makes any mix of humans and AI work without a separate code path.

Shell
- Main menu lists all eleven games; the nine without engines are marked
  coming soon and are driven entirely by GameCatalog.
- Settings: sound, animation speed (one multiplier drives card movement
  and AI thinking time), and OTA updates from the latest GitHub release.
- Layouts measure available space rather than assuming an orientation.

The game package is free of Android types, so the rules engines and AI
run under plain JUnit; 43 tests cover ranking, following suit, scoring,
sequence detection, redaction, wire round-trips and full random and AI
playthroughs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015qjfMiPUDshdKEUa6vxqzN
This commit is contained in:
Claude
2026-08-05 22:37:05 +00:00
parent 4312616efa
commit 487c68419e
54 changed files with 6487 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
# Euchre — implemented rules
This is the ruleset the engine enforces, so you can check it against how you
actually play. Anything marked **toggle** is exposed in the game setup screen;
anything else is currently fixed and would need a code change.
## Table
- Four players, two fixed partnerships. Seats 0 and 2 are one team, seats 1 and
3 are the other, so partners sit opposite each other.
- The deal rotates one seat clockwise after every hand.
## Deck — *toggle*
- **24 cards** (9, 10, J, Q, K, A in each suit). The standard game.
- **32 cards** (7 through A). Five cards are still dealt to each player and one
is still turned up, so the extra cards simply deepen the undealt remainder.
Some 32-card variants deal eight cards and play eight tricks; that is *not*
what this does.
## Ranking
With trump named, the order from the top is:
1. **Right bower** — the jack of trump.
2. **Left bower** — the jack of the *same colour* as trump. It counts as a trump
card, not as a card of its printed suit. If spades are trump, the jack of
clubs is a spade for the whole hand: it must be played when spades are led,
and it does *not* satisfy following clubs.
3. A, K, Q, 10, 9 of trump.
Non-trump suits rank A, K, Q, J, 10, 9. A card that is neither trump nor of the
led suit cannot win a trick.
## Bidding
**Round one.** Starting to the dealer's left, each player may order up the
turned card or pass. Ordering up makes that card's suit trump; the dealer takes
the card into hand and discards one card face down.
**Round two.** If all four pass, the turn card is turned down and its suit may
not be named. Starting again to the dealer's left, each player may name any
other suit or pass.
**Stick the dealer — *toggle*, on by default.** If the first three players pass
in round two, the dealer must name a suit. With the toggle off, a fourth pass
throws the hand in and it is redealt by the next dealer.
**Going alone — *toggle*, on by default.** A maker may declare going alone when
ordering up or naming trump. Their partner sits the hand out entirely and plays
no cards; the hand is played three-handed.
## Play
- The player to the dealer's left leads to the first trick; after that the
winner of each trick leads to the next.
- You must follow the led suit if you hold it, remembering that the left bower
belongs to trump. Otherwise you may play anything.
- Five tricks are played.
## Scoring
Let the makers be the team that named trump.
| Outcome | Points |
| --- | --- |
| Makers take 3 or 4 tricks | 1 to the makers |
| Makers take all 5 | 2 to the makers |
| Makers take all 5, playing alone | 4 to the makers |
| Makers take fewer than 3 (euchred) | 2 to the defenders |
A lone hand that takes 3 or 4 tricks scores 1, the same as an ordinary make.
**Game — *toggle*.** First team to **10** points (default), or 11, or 15.
## Known simplifications
- Cards are dealt five at a time rather than in the traditional 3–2 / 2–3
packets. With a shuffled deck this changes nothing about the odds, but it does
mean the deal does not *look* like a real one.
- No defending alone, no farmer's hand, no notrump or misère bids.
+77
View File
@@ -0,0 +1,77 @@
# Sequence — implemented rules
This is the ruleset the engine enforces. Anything marked **toggle** is exposed
in the game setup screen.
## ⚠️ The board layout is not the commercial one
`SequenceBoard.LAYOUT` in `SequenceModel.kt` is a **generated** 10×10 layout, not
a reproduction of the printed Sequence board. It was generated because the real
arrangement could not be verified from here, and shipping a guessed one labelled
as authentic would have been worse than shipping an honest substitute.
It satisfies every property the rules depend on:
- each of the 48 non-jack cards appears exactly twice,
- the four corners are free squares,
- no card is adjacent to its own twin (including diagonally).
So the game plays correctly — but square for square it will not match a physical
board, and two players using this app plus one physical board would disagree.
To fix that, replace the ten strings in `LAYOUT` with the real arrangement.
Nothing else needs to change; the parser, the tests and the AI all read from it.
## Table
- **Teams — *toggle*.** Two or three. Seats are dealt round-robin into teams, so
team-mates are never seated adjacently.
- **Players per team — *toggle*.** 1 to 4.
- **Sequences to win — *toggle*.** Defaults to 2 for two teams and 1 for three
teams, matching the usual rule, but can be set explicitly.
## Cards
Two full 52-card decks, shuffled together — 104 cards.
Hand size shrinks as the table grows:
| Players | Cards |
| --- | --- |
| 2 | 7 |
| 3–4 | 6 |
| 5–6 | 5 |
| 7–9 | 4 |
| 10+ | 3 |
After playing a card you draw a replacement. If the draw pile runs out, the
discards are shuffled to form a new one.
## Turn
Play one card and place a chip on a matching empty square, then draw.
- **Two-eyed jacks** (♦ and ♣) are wild: place a chip on any empty square.
- **One-eyed jacks** (♥ and ♠) remove one opposing chip — but never a chip that
is part of a completed sequence, and never your own team's chip.
- **Dead card — *toggle*, on by default.** If both squares printed with your card
are already occupied, you may discard it and draw a replacement. This does not
cost your turn, and you may do it once per turn.
## Sequences
A sequence is five chips in a row — horizontally, vertically or diagonally.
- The **four corners are free squares** and count towards any team's sequence.
- Two sequences may **share at most one chip**. The engine enforces this by
refusing to count a run of five that contains more than one already-locked
square.
- Chips in a completed sequence are locked and cannot be removed by a one-eyed
jack.
The first team to reach the sequence target wins immediately.
## Known simplifications
- A completely blocked table (no legal move for anyone) ends the game without a
winner rather than triggering a formal draw.
- The AI does not count cards or track which squares opponents can still reach.