Spanish deck (baraja española) and Spanish-deck games
Summary. Add the Spanish deck as data first, then games. Make the deck a spec file (spec/decks/*.json) that rule sets name, so the three cores stop hard-coding the 52+2 French deck. Draw the cards ourselves in code, as we do for French: licensing for Fournier-style art is murky and a drawn deck keeps the “rank first, big pip, never colour alone” rule. Build Chinchón first (a rummy, closest to Canasta: melds, discard pile, scoring over hands, house-rule variety), then Brisca (trick-taking engine that also unlocks Tute and Guiñote), then Escoba. Leave Mus and Truco until a bluffing and signals design exists. Names and rule terms are Spanish-native; the strings depend on docs/plans/i18n.md, which this plan does not duplicate. Demand evidence is qualitative (guides and app-store pages); no source I opened gives per-game player numbers.
1. The deck
Composition
| Version | Cards | Ranks | Notes |
|---|---|---|---|
spanish-40 |
40 | 1–7, sota (10), caballo (11), rey (12) | Brisca, Tute, Escoba, Chinchón, Mus (some regions), Truco, Guiñote, Siete y medio |
spanish-48 |
48 | 1–9, 10, 11, 12 | Adds 8 and 9 (Mus variants, Cinquillo, Pocha use 40 or 48 by house) |
| comodines | +2 | JK |
Optional; Chinchón is often played with 2 jokers from the 48+2 pack |
Suits: oros (coins), copas (cups), espadas (swords), bastos (clubs). Wikipedia says most decks have 40 or 48 cards, that 48-card decks have been sold with two jokers since the mid-20th century, and that faces are sota, caballo and rey, with older decks also having a 10-pip rank (https://en.wikipedia.org/wiki/Spanish-suited_playing_cards, opened). Numbering faces 10, 11, 12 is the usual convention and keeps ranks numeric.
Card codes
Spanish code = rank number + a lowercase suit letter: o oros, c copas, e espadas, b bastos. Examples: 1o, 7c, 12e (rey de espadas), 11c (caballo de copas). The joker stays JK.
- No clash: French suits are uppercase
C D H Sand the existing format is case-sensitive; French ranks includeA J Q K, Spanish uses only digits.1o,11cand12bare not French cards, and10H,3Dare not Spanish. - Risk (inference):
cvsCis easy to mistype in hand-written scenarios. Mitigation: the parser is told its deck, and parses only that alphabet, so a stray7Cin a Spanish scenario fails with a clear error. If that feels fragile, the fallback is a prefix (s:7c), which I would avoid because every pile and hand in JSON gets longer. - Add invalid-file cases for both directions (
7Cin a Spanish rule set,7cin a French one) tospec/invalid/.
Decks as data
New files:
spec/decks/french.json { "id": "french", "ranks": [...], "suits": [...], "jokers": 2, "order": "suit-major" }spec/decks/spanish-40.json { "id": "spanish-40", "ranks": ["1".."7","10","11","12"], "suits": ["o","c","e","b"], "jokers": 0 }spec/decks/spanish-48.jsonA rule set gains a deck field (default for existing files: french; the README says every rule set has every field, so add it to official.json and family.json explicitly). tables[].decks keeps meaning “copies of this deck”. Deck order becomes “the deck file’s suits in order, each suit’s ranks in order, then jokers”, which reproduces today’s French order (C, D, H, S; A..K; JK JK), so the existing shuffle and deal parity vectors must stay byte-identical. That is the regression gate.
What changes per core:
| Core | Change |
|---|---|
Swift (CanastaCore), Kotlin (canasta.core) |
Card’s rank and suit enums become values loaded from the deck (struct with ids), or a small enum per deck behind a Deck protocol; the parser and sorter take a Deck; deck construction reads the file. Canasta-only logic (wild, red three) stays in the Canasta module and is not generalised |
Rust (canasta-rules, canasta-wasm) |
Same, plus the Wasm interface and the server’s snapshot format carry the deck id so a client rebuilds the same cards |
| Shared | Suggest splitting a game-agnostic cards crate/module (deck, PCG32, shuffle, parse) from the Canasta rules; docs/architecture.md already wants “game core” separate from platform, and a second game is the trigger |
Tests: add shuffle cases for spanish-40 and spanish-48 (a deck key on each case, defaulting to french so old cases need no edit); add sortHand cases (Spanish suit order oros, copas, espadas, bastos is the traditional listing; sorting by rank uses game-specific strength, so the order value is a game concern, not a deck one); add a parse/format round-trip file parity/cards.json. The saved-game format needs deck (version 2, with every core loading v1 as French).
2. Drawing and accessibility
Pips
Draw four SVG paths in the 24x24 box already used by suitPaths in web/src/CardViews.tsx (opened). To be drawn by us, not traced from Fournier art:
- Oros: a coin, a ring plus an inner disc, as two subpaths with even-odd fill so the centre reads as a coin, not a dot.
- Copas: a goblet: bowl, stem, foot.
- Espadas: a straight double-edged blade with a cross-guard and pommel, drawn diagonal or vertical. Distinct from the French spade, which is a leaf.
- Bastos: a knobbed cudgel, thicker at one end, with two or three small knots.
Four distinct silhouettes (circle, bowl, blade, club) mean shape alone separates them at the 12 pt mini size. Check the silhouettes at mini (12 px) in the first prototype; a thin sword blade is the likeliest to fail, so give it a wide guard.
Colour and contrast
Traditional hues: gold, red, blue, green. Computed contrast ratios (my calculation, WCAG formula):
| Suit | Ink | vs cardFace #FFFFFF |
vs dark-mode cardFace #ECE9E1 |
Relative luminance |
|---|---|---|---|---|
| Oros | #7A5200 (dark gold/bronze) | 6.9 | 5.7 | 0.102 |
| Copas | #C4122F (existing red) | 6.0 | 5.0 | 0.124 |
| Espadas | #1B3F8F (navy) | 9.8 | 8.0 | 0.058 |
| Bastos | #1B6B33 (deeper green) | 6.6 | 5.4 | 0.110 |
All clear 4.5:1 on both faces, which is the bar tokens.json already sets. The existing four-colour French blue (#1C5DB8) and green (#17773A) would also pass (5.2 and 4.6 on dark face) but they are near each other in luminance (0.115 vs 0.137), so a deuteranope sees copas red, espadas blue and bastos green at nearly the same lightness. Fix: espadas goes darker (navy, 0.058) than the others; oros is a bronze, not a bright yellow, because bright gold fails contrast on white. This gives roughly three lightness tiers, but copas, oros and bastos remain close (0.10–0.12). So the rule stays: colour is the third cue, after the silhouette and the suit word in the index (below). Add suit.spanish to design/tokens.json next to fourColour and classic, and run the existing token generator. Verify with a simulator for deuteranopia and protanopia before choosing final hexes.
Corner index (instead of pintas)
Pintas are gaps in the border that let you read a card’s rank from the back of the deck, a mechanic that only matters for physical cards. Replace with the existing rule: rank over a pip in the corner, numeric, large (hand rank 26). Faces show their number (10, 11, 12) large, with a small word under it at hand and pile sizes (SOTA, CAB., REY) and the number alone at mini. The centre pip is large, in a frame in the suit colour. In the 40-card deck, a 7 is the highest pip; the first-class check is that 7, 10, 11 and 12 can be told apart at a glance because these are the cards players decide on (Brisca, Escoba, Truco).
Screen-reader names
Spanish-native, article-correct: “As de oros” (1), “Tres de copas”, “Sota de bastos”, “Caballo de copas”, “Rey de espadas”. Selected: “Caballo de copas, seleccionada” (carta is feminine). Plural rank names for meld labels (“Reyes”). The names are strings, so they go through the i18n plan’s catalogue, not code. A French-deck game in Spanish (“As de picas”) also needs this; coordinate.
Artwork licensing
I could not confirm a usable free Spanish-deck SVG set.
- The Commons category for Spanish playing cards (https://commons.wikimedia.org/wiki/Category:Spanish_playing_cards, opened) lists suit-symbol SVGs (denari, bastoni, coppe, spade in “carte spagnole/catalane/marocchine/minchiate”) but no complete deck, and states licences are per file, with no author shown on the category page.
- Fournier’s Castilian pattern dates from 1889 (https://en.wikipedia.org/wiki/Spanish-suited_playing_cards). A search result showed a 2019 Fournier deck with “© 2019 Naipes Heraclio Fournier, S.A.” (search snippet, not opened), so modern Fournier art is not free to reuse. The 1889 design’s own copyright status is uncertain to me, and photographs of a given printing are a different question; this needs a lawyer, not a guess.
- A search snippet mentioned a self-released public-domain Commons photo of a Fournier deck (JPG only, not opened). A photo of the product does not give us vector art.
Recommendation: draw our own, as docs/card-artwork.md already recommends for French as the zero-provenance fallback. The 40-card deck needs only four pips, number indices and three court frames (sota, caballo, rey) per suit; courts can start as the big-numeral frame and later get simple line figures drawn by us. No court art means no licence risk and fits the “rank over suit” design. Record this in docs/card-artwork.md once decided.
3. Candidate games
Demand evidence is qualitative. Opened: Wikipedia (Spain: Brisca, Mus “very popular”, Tute, Chinchón, Siete y media; Ecuador: Cuarenta; Morocco: Ronda), Pagat’s Spain page (https://pagat.com/national/spain.html: lists Tute, Brisca, Julepe, Escoba, Mus “now played all over Spain”, Siete y media, Burro, Manilla, Botifarra), Guía del Ocio (https://guiadelocio.es/madrid/plan/juegos-de-cartas-en-espana-el-plan-de-ocio-que-sigue-llenando-mesas/: Mus tournaments, brisca and cinquillo as simple entry games, Guiñote compared with Mus in Aragón; no figures), Xataka on Mus (https://www.xataka.com/literatura-comics-y-juegos/todo-mundo-conoce-mus-casi-nadie-sabe-jugar-correctamente-universo-variantes-subjuegos-cartas-toda-espana: no unified rulebook, regional rules differ on signals and 4 vs 8 kings), and the Truco Uruguayo page on mwm.ai (https://mwm.ai/apps/truco-uruguayo/490977592: 100k+ downloads, 4.1K ratings, 4.6 stars, free with credits, publisher Web2mil / ConectaGames; third-party tracker). Latin American popularity of Truco and Mexico’s games is my inference; I did not open a source that quantifies either. Store competition is unaudited: I only saw Truco apps (Web2mil’s Truco Argentino and Uruguayo, Truco Argento, Gran Truco Argentino) in search results.
| Game | Players | Where (evidence) | House-rule variety | Engine reuse | Bot difficulty | Store competition | Size |
|---|---|---|---|---|---|---|---|
| Chinchón | 2–8 (usually 2–4) | Spain; named on Wikipedia | High (jokers, cut-and-close, 7.5 limit, “chinchón” bonus) | High: rummy melds, draw/discard, multi-hand scoring | Medium (meld planning) | Inference: many free apps | M |
| Brisca | 2 or 4 (pairs) | Spain; “simple, quick” starter | Medium (3 cards, trump, signals in pairs) | Trick-taking: new trick engine | Easy–medium | Unaudited | M |
| Escoba (de 15) | 2–4 | Spain, Latin America (inference) | Medium (scoring of “sevens”, sweeps) | Fishing: new capture engine | Medium (subset-sum search) | Unaudited | M |
| Tute / Tute Habanero | 2–4 | Spain (Wikipedia, Guía del Ocio) | Medium (cantes, arrastre) | Brisca’s trick engine plus declarations | Medium | Unaudited | M after Brisca |
| Guiñote | 2 or 4 | Aragón/Valencia (inference from Guía del Ocio) | Medium | Same family as Tute | Medium | Unaudited | S–M after Tute |
| Mus | 4 (pairs) | Spain; “very popular” | Very high (no unified rules, Xataka) | New: betting rounds, partner signals | Hard: hidden partner information, señas | Unaudited | L |
| Truco (Arg., Uru.) | 2, 4 or 6 | Argentina, Uruguay: 100k+ downloads for one Uruguayo app | High (flor, envido variants) | New: bluffing, challenge chain, señas | Hard | Inference: crowded, an incumbent has 4.1K ratings | L |
| Siete y medio | 2–8 | Spain | Low | Simple banking; no match to Canasta | Easy | Unaudited | S |
| Cinquillo | 2–4 | Spain | Low–medium | Sequence-laying, like Sevens | Easy | Unaudited | S–M |
| Pocha | 3–6 | Spain | Medium (bid exactly) | Bidding trick-taking, after Brisca | Medium | Unaudited | M |
| Julepe | 2–6 | Spain (Pagat) | Low | Plain-trick, simple | Easy | Unaudited | S |
| Burro / children’s | 2–6 | Spain, Mexico (inference) | Low | Trivial | Trivial | Unaudited | S |
4. Recommended order
- Spanish-deck foundation (deck data, parity gate, drawing, tokens). No game ships; the work is the generalisation and is the riskiest part, so doing it alone keeps the French parity vectors as proof.
- Chinchón. Reuses the most: hand, draw/discard, melds (sets and runs, no wilds except jokers), per-hand scoring with a game target, rule sets as data, the existing bot structure (Easy and Normal), the saved-game format, and the table UI. Needs: a
gameid on tables (architecture notes this is deferred “once a second game exists”; this is that moment), a registry entry inweb/src/games.ts, and the platform work below. House-rule variety is a good fit for “by your family’s rules”. - Brisca, then Tute and Guiñote as rule sets and a declarations layer over the same trick engine. Brisca first because it is the simplest trick game and teaches the engine; trick-taking is also reusable for Pocha.
- Escoba: a self-contained capture engine; cheap to bot with a subset-sum search.
- Mus and Truco last. Both need partner signals, bluffing and bidding rounds; bots that play them credibly and an online UI that does not leak hidden information are separate research projects. Truco also meets entrenched incumbents.
Platform work each game needs: a game id in the server protocol and tables; a game-specific core on three platforms plus the Wasm build; a UI module per platform; a registry entry; a spec/rulesets/ set, scenarios and bots.md section; behaviour tests via each CLI; and a rules page on the marketing site. A shell app and a bundle-id decision (per docs/architecture.md) come due at game two regardless of which game it is; flag it as the dependency to resolve before step 2.
5. Localization
Spanish deck names, card names (“Caballo de copas”), suit names, game names and rules terms (envido, cante, escoba, chinchón) are Spanish-native and should not be translated for Spanish users; English users get the same names, perhaps with a short gloss. All strings go through the catalogue in docs/plans/i18n.md (being written in parallel). This plan depends on it for: which languages ship with the first Spanish game (Spanish first, or both), plural forms and grammatical gender in accessible names (“seleccionada”), and Latin-American versus Spain Spanish (voseo in Argentina and Uruguay, vocabulary in Mexico). I do not specify the mechanism here.
Open questions for Eduardo
- Which Spanish-deck games does your family actually play, and with which rules? Chinchón first is my pick; if it is Mus or Truco, the order changes.
- Spain or Latin American variants first (Truco Argentino versus Uruguayo, Escoba rules, cut-and-close in Chinchón)?
- Spanish deck for Canasta too? Canasta needs 52+2 French cards, so no, but the deck setting could still offer the Spanish look for games that use 40 cards.
- Draw courts ourselves (my recommendation), or commission art?
- 40 or 48 cards by default, and should comodines be a rule-set option?
- Is it acceptable to introduce the
gameid and the cards crate before any Spanish game ships? - Should I get the Fournier 1889 pattern’s status checked by a lawyer, or just avoid it as planned?