diff --git a/lyra/web/static/hand.html b/lyra/web/static/hand.html index 60577ba..7c5f1df 100644 --- a/lyra/web/static/hand.html +++ b/lyra/web/static/hand.html @@ -3,13 +3,13 @@ - + Lyra — Hand @@ -140,7 +140,9 @@ // place seats around the oval const seatsEl = document.getElementById('seats'); + const starts = {}; ordered.forEach((p,i)=>{ + starts[p.pos] = (p.stack!=null ? Number(p.stack) : null); const ang = (90 + i*(360/n)) * Math.PI/180; // bottom = 90deg const x = 50 + 46*Math.cos(ang), y = 50 + 44*Math.sin(ang); const el = document.createElement('div'); @@ -151,7 +153,7 @@ el.innerHTML = `
${esc(p.pos||'')}
` + (p.name?`
${esc(p.name)}
`:'') + `
${hcards?cards(hcards,true):'xx'}
` - + (p.stack!=null?`
${esc(p.stack)}
`:'') + + `
${p.stack!=null?esc(p.stack):''}
` + `
`; seatsEl.appendChild(el); }); @@ -167,25 +169,47 @@ return `
${esc(a.street||'')}${esc(a.pos||'')} ${esc(a.action||'')}${amt}
`; }).join(''); + const cap = s => s ? s[0].toUpperCase()+s.slice(1) : s; + const fmt = n => Number.isInteger(n) ? n : Math.round(n*100)/100; + function draw(){ - let pot = 0, board = [], street = 'Preflop'; + let board = [], street = 'Preflop'; const lastAct = {}, folded = {}; + // street-aware chip accounting: amounts are "to" totals for the street + const contrib = {}; // committed in prior (flushed) streets + let streetCommit = {}, streetBet = 0, curStreet = 'preflop'; + const flushStreet = () => { for(const p in streetCommit){ contrib[p]=(contrib[p]||0)+streetCommit[p]; } streetCommit={}; streetBet=0; }; for(let i=0;i{ committed[p]=(contrib[p]||0)+(streetCommit[p]||0); pot+=committed[p]; }); boardEl.innerHTML = cards(board); - potEl.textContent = pot ? ('Pot ~'+pot) : ''; + potEl.textContent = pot ? ('Pot '+fmt(pot)) : ''; streetEl.textContent = street; document.querySelectorAll('.seat').forEach(s=>{ const pos=s.dataset.pos; s.querySelector('[data-act]').textContent = lastAct[pos]||''; s.classList.toggle('folded', !!folded[pos]); s.classList.remove('acting'); + const stEl=s.querySelector('[data-stack]'), start=starts[pos], c=committed[pos]||0; + if(start!=null){ const rem=start-c; stEl.textContent = rem<=0 ? 'all in' : fmt(rem); } + else { stEl.textContent = c ? '−'+fmt(c) : ''; } }); const cur = acts[step-1]; if(cur && cur.pos){ diff --git a/lyra/web/static/hands.html b/lyra/web/static/hands.html index 7055f51..f6d3e36 100644 --- a/lyra/web/static/hands.html +++ b/lyra/web/static/hands.html @@ -3,10 +3,10 @@ - + Lyra — Hands diff --git a/lyra/web/static/journal.html b/lyra/web/static/journal.html index 0fb8995..4efba0f 100644 --- a/lyra/web/static/journal.html +++ b/lyra/web/static/journal.html @@ -3,13 +3,13 @@ - + Lyra — Journal