Add Kaiser, Crazy 8s and Wizard

Three more card games, engine to screen.

Kaiser: 32-card prairie trick-taking with bidding, the five of hearts
worth five and the three of spades costing three. Bidding is capped at
ten because ten is all a hand can be worth, and a losing score gives the
game a floor — without one a table that keeps bidding and going down
never reaches a result.

Crazy 8s: eights are wild and name the suit in force, which is why the
table states that suit in words rather than leaving it to be read off
the pile. Blocked rounds are scored rather than hanging.

Wizard: the 60-card deck, one more card dealt each round until the pack
runs out, bid your tricks exactly. The shared card model gains WIZARD
and JESTER ranks, so every ordinary deck now builds from Rank.standard
rather than walking the whole enum.

Also fixes a lobby bug this would have hit: hosting seated the
catalogue minimum rather than the table the host had just set up, so a
six-handed game would have been rejected by its own rules engine.

164 engine tests pass locally.
This commit is contained in:
Claude
2026-08-06 10:21:23 +00:00
parent f5a2626196
commit fb70396d09
26 changed files with 4504 additions and 24 deletions
+59
View File
@@ -0,0 +1,59 @@
# Crazy 8s — implemented rules
This is the ruleset the engine enforces. Anything marked **toggle** is in the
game setup screen.
## Table
- 2 to 6 players — **toggle**. Everyone plays for themselves.
- One 52-card deck.
- Seven cards each heads-up, five otherwise — **toggle** to fix it at 5, 7 or 9
instead.
- The rest becomes the stock; one card is turned up to start the discard pile.
If that card is an eight, the suit it shows is the one in force.
## Play
On your turn, play one card that matches either
- the **suit in force**, or
- the **rank** of the card on top of the pile.
**Eights are wild.** An eight may be played on anything, and the player names
the suit that is then in force. This is why the suit in force is stated in words
on the table rather than left to be read off the pile — after an eight, the top
card tells you nothing.
If you cannot play:
- **Draw until you can — *toggle*, on by default.** Keep drawing until a
playable card turns up, or until there is nothing left to draw.
- With the toggle off, draw a single card; if it still does not play, the turn
passes.
- When the stock is empty it is rebuilt from the discards, leaving the top card
in place. If there is genuinely nothing to draw and nothing to play, you pass.
If every player passes in turn, the round is blocked and ends with nobody out.
## Scoring
The round ends when a player sheds their last card. Everyone else scores penalty
points for what they were caught holding:
| Card | Penalty |
| --- | --- |
| Eight | 50 |
| Ten, jack, queen, king | 10 |
| Ace | 1 |
| Everything else | Face value |
A blocked round is scored the same way — everyone still holding cards pays for
them.
Lowest total after the last round wins — **toggle** for 1, 3 or 5 rounds.
## What the computer opponent does
It plays the most expensive card it can get rid of, saves its eights until the
endgame or until it has nothing else, and when it does play one it names the
suit it holds most of.
+78
View File
@@ -0,0 +1,78 @@
# Kaiser — implemented rules
Kaiser is the prairie game, played hard in Saskatchewan and not much anywhere
else. This is the ruleset the engine enforces. Anything marked **toggle** is in
the game setup screen.
## Table
Four players in two partnerships, sitting opposite. Seats 0 and 2 are one team,
seats 1 and 3 the other.
## The deck — 32 cards
Eight through ace in every suit, plus:
- the **seven of clubs** and the **seven of diamonds**, which are ordinary cards
making up the count, and
- the **five of hearts** and the **three of spades**, which replace the other
two sevens and are what the whole game is played for.
Eight cards each, and the deck is exhausted.
## What a hand is worth
Ten points, always:
| Source | Points |
| --- | --- |
| Each of the eight tricks | 1 |
| Taking the five of hearts | +5 |
| Taking the three of spades | −3 |
So a trick containing the five of hearts is worth six, and one containing the
three of spades is worth minus two. Both in the same trick is worth three.
## Bidding
Bidding opens to the dealer's left and goes round. Each bid is a number of
points the bidder's side undertakes to take.
- The floor is **5, 6, 7 or 8** — **toggle**, six by default.
- The ceiling is ten, because ten is the most a hand can be worth. Bidding
above what exists is only a way to guarantee going down, so it is not offered.
- **No trump** — **toggle**, on by default. A no-trump bid outranks the same
number bid with a suit; it pays double and costs double.
- Each bid must beat the one before it.
- If the first three players pass, the dealer must bid — there is no throwing
the hand in from the dealer's seat. If all four pass (only possible when the
dealer's forced bid is somehow not reached), the hand is redealt.
The winning bidder then names trump, or is committed to no trump if that is what
they bid.
## Play
The bidder leads. Follow suit if you can; otherwise play anything.
There are no bowers — Kaiser ranks straight down from the ace, so the jack is
just a jack. Trump beats every other suit; otherwise only the led suit can win.
## Scoring
- **Bidding side made it** (took at least the bid): they score every point they
took, doubled if the contract was no trump.
- **Bidding side went down**: they lose the amount of the bid, doubled if it was
no trump.
- **Defenders always keep what they took**, made or not.
First side to the target wins — **toggle** for 32, 52 or 62 points. A side that
falls to the matching negative score loses outright; without that floor a table
that keeps bidding and keeps going down never reaches a result at all.
## What the computer opponent does
It rates each suit by trump length and top cards, adds for holding the five of
hearts and subtracts for holding the three of spades, and bids the floor rather
than reaching. In play it chases the five of hearts, ducks when the three of
spades is on the table, and lets its partner have a trick it is already winning.
+81
View File
@@ -0,0 +1,81 @@
# Wizard — implemented rules
This is the ruleset the engine enforces. Anything marked **toggle** is in the
game setup screen.
## Table
- 3 to 6 players — **toggle**. Everyone plays for themselves.
## The deck — 60 cards
An ordinary 52-card pack plus **four wizards** and **four jesters**.
## Rounds
Round 1 deals one card each, round 2 deals two, and so on until the pack runs
out. That is 20 rounds with three players, 15 with four, 12 with five and 10
with six. **Toggle** to stop after 5 or 10 rounds instead of playing the lot.
After the deal, the next card off the pack is turned for trump:
- an ordinary card — its suit is trump;
- a **jester** — the round is played with no trump;
- a **wizard** — the dealer names trump before anyone bids.
In the last round the whole pack has been dealt, so there is no card to turn and
no trump.
## Bidding
Starting to the dealer's left, each player says exactly how many tricks they
will take, from none up to the number of cards in hand. Every bid is heard, so
the later you bid the more you know.
**Screw the dealer — *toggle*, off by default.** The dealer may not name the
number that would make the bids add up to the tricks available, so at least one
player at the table is always going to be wrong.
## Play
The player to the dealer's left leads. Follow the led suit if you hold it —
except that a **wizard or a jester may always be played**, whatever you hold.
Playing one is how you get out of following.
**What suit is led:**
- an ordinary card leads its suit;
- a **jester** leads nothing — the suit is set by the next ordinary card;
- a **wizard** reaching the front means no suit is led at all, and everyone may
play whatever they like.
**Who takes the trick:**
1. The **first wizard** played takes it, whatever else is down.
2. Otherwise the highest trump.
3. Otherwise the highest card of the led suit.
4. A **jester** never wins — except a trick of nothing but jesters, which goes
to the first one played.
## Scoring
| Result | Score |
| --- | --- |
| Bid made exactly | 20, plus 10 for each trick taken |
| Bid missed | −10 for every trick over or under |
So bidding none and taking none is worth 20; bidding three and taking three is
worth 50; bidding three and taking one costs 20.
Highest total after the last round wins.
## What the computer opponent does
It counts its expected tricks — a wizard is one, a jester is none, and
everything else is a fraction depending on how high it is and whether it is
trump — and bids the nearest number still on offer. In play it chases tricks
while it is short of its bid, taking them as cheaply as it can, and ducks once
it has them, leading a jester when it has one to spare.
Over long runs of self-play it lands its bid exactly around half the time,
against about one in six for random legal play.