diff --git a/lyra/poker.py b/lyra/poker.py index b645564..6adfe4f 100644 --- a/lyra/poker.py +++ b/lyra/poker.py @@ -216,7 +216,7 @@ Schema: "game": "NLH" | "PLO" | ..., "stakes": "", "hero_pos": "", - "hero_cards": ["Rs", ...], // rank+suit; suit one of s h d c; null if unknown + "hero_cards": ["As","Ax", ...], // rank+suit (s/h/d/c); 'x' suit if unknown e.g. "Ax"; "x" for a fully unknown card "players": [ // every player mentioned, incl. hero {"pos": "", "stack": , "name": , "cards": [".."]|null} ], @@ -230,8 +230,13 @@ Schema: } Rules: infer positions and street order sensibly. Amounts are plain numbers (no $). \ -Normalize cards like "Ah","Td","9s". Use null/omit for anything not stated. Stay faithful \ -to what's described โ€” do not invent action that isn't implied.""" +NEVER invent suits or cards. A card is rank+suit where suit is one of s/h/d/c; if the suit \ +wasn't stated, use 'x' for the suit (e.g. "Ax","Kx","4x"); if a whole card wasn't stated, \ +use "x". Examples: "AA with the ace of spades" -> hero_cards ["As","Ax"]; "AK on an A4x \ +board" -> board ["Ax","4x","x"]. Each card is independent: a suit named for one card does \ +NOT apply to another โ€” e.g. your hole "ace of spades" is a different card from a board ace \ +whose suit is unstated (that board ace is "Ax", not "As"). Use null/omit for non-card \ +details not stated. Stay faithful to what's described โ€” do not invent action that isn't implied.""" def _safe_json(s: str) -> dict | None: diff --git a/lyra/web/static/hand.html b/lyra/web/static/hand.html index 67197ca..60577ba 100644 --- a/lyra/web/static/hand.html +++ b/lyra/web/static/hand.html @@ -37,6 +37,8 @@ .card .r{font-size:1rem;} .card.red{color:#c8102e;} .card.back{background:#2a3550;color:#2a3550;} + .card.unknown{background:#2a3550;color:#7c879e;font-size:1.2rem;} + .card .nosuit{color:#9aa3b5;} .seat{position:absolute;transform:translate(-50%,-50%);width:96px;text-align:center; background:rgba(13,16,22,.85);border:1px solid var(--border);border-radius:10px;padding:5px 4px;} @@ -84,9 +86,12 @@ function cardEl(code, sm){ if(!code) return ''; - const m = String(code).trim().match(/^(10|[2-9TJQKA])\s*([shdc])$/i); - if(!m) return `${esc(code)}`; + const c = String(code).trim(); + if(c.toLowerCase()==='x') return `?`; + const m = c.match(/^(10|[2-9TJQKA])\s*([shdcx])$/i); + if(!m) return `${esc(c)}`; const r = m[1].toUpperCase().replace('10','T'); const s = m[2].toLowerCase(); + if(s==='x') return `${r}ยท`; return `${r}${SUIT[s]}`; } const cards = (arr, sm) => (arr||[]).map(c=>cardEl(c,sm)).join('');