47:51Ranking major U.S. Open-Weights Models. (Where does Ripple 65B fit in?)
Nov 6, 2026 · YouTube
10:57"Crouton Alpha": the latest super-efficient coding model by Meta?
Nov 3, 2026 · YouTube
38:58Testing Particle-1: a post-trained DeepSeek V4.1 Flash specializing in coding and efficiency
Oct 28, 2026 · YouTube
29:55Kimi K3.1 Pro Looked Incredible. Then I Kept Testing.
Oct 26, 2026 · YouTube
22:47Mistral Large 4 Is Cheap. But Is It Good Enough to Compete?
Oct 6, 2026 · YouTube
16:54Stealth Union Alpha: Is this another cheap GPT model? (better than Luna, cheaper than Terra?)
Sep 16, 2026 · YouTube
16:45DeepSeek V4.1 Flash Is Shockingly Good for the Price
Sep 10, 2026 · YouTube
17:37Tencent Hy4 Preview Tested: Is It Really Better Than Kimi K3 and GLM 5.3?
Aug 28, 2026 · YouTube
23:58Qwen 3.8 Flash Tested: UI, Coding, Physics & more - compared to Opus 5, Sol Pro, Grok
Aug 27, 2026 · YouTube
14:50Stealth Ox Alpha: a new GLM model! Full test (coding & writing) against Grok, Gemini, GPT & others
Aug 21, 2026 · YouTube
My buddy runs a bar. I told him I'd build him something for Thursdays. He's the one talking here — I just write down what he says and hand it to you.
It's not real pool. Three balls on the table, you shoot until all three are down, and we count how many shots it took you. Low is good. Everybody takes a turn, then we go around again — that's a round.
Twenty bucks to play. You start with five chips. Take more than four shots to clear the table and it costs you a chip. Out of chips and you're out, go back to drinking. Last one with chips left takes the pot.
There's a clock on your turn — a minute, minute and a half, we've never really settled it. Clock runs out and you're not at the table, that's a chip.
It's a Thursday. Nine o'clock, everybody's had a few, the jukebox is loud and half the room is outside smoking. Twelve, sixteen people usually, however many show up. It runs two, three hours and nobody's in a hurry.
Last year I ran the whole thing on a legal pad and it got away from me around round four. Two guys arguing with me about what they shot, me trying to remember whose turn it was, somebody's beer on the pad. Never again.
I'm running this off my phone, one-handed, standing at the table with a beer in the other. There's a TV over the bar and that's the only screen anybody in the room can see — from across the room, in the dark, so it's got to be big. People want to know where they stand without walking over and asking me.
My phone's on 15% by ten. The bar's wifi is the bar's wifi.
Twenty a head, all of it in the pot. Winner takes it — mostly. We kick a little to second. And there's a side thing we do for whoever's shooting best early on, I never wrote that part down properly.
The app doesn't hold the money. I do. But at the end of the night it has to tell me what I owe who, and I'm reading that off my phone with sixteen people standing around the table.
Two pages.
The console — the thing I run it from, and the thing that goes up on the TV. Open it and there's already a game going. I'm not typing in twelve names to find out whether it works.
The playback — a separate page that plays a whole night through, start to finish, so I can watch it work before Thursday. One step at a time, a step being one thing happening, with the scorecard filling in as it goes and a slider for how fast it runs. I want to slow it down, back it up, and read what just happened. Show me the way a night actually goes.
The playback runs the same rules the console runs. If the two of them drift apart, the playback is a cartoon and it's no use to me.
data: URIs are fine.localStorage, sessionStorage, cookies or indexedDB — these run in a sandboxed frame where those throw.html blocks: the console first, the playback second. Leave yourself room for the second one.I know I wasn't clear about everything. Everything you had to decide for me, one line each — what you decided and why. Short.
The first fenced html block.
The second fenced html block.
It's Thursday, it's nine o'clock, and I'm running this for real. What comes up that this doesn't handle? Be straight with me. I'd much rather hear it now than find out with sixteen people around a pool table and three hundred dollars sitting on the bar.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Thursday Pool Console</title>
<style>
:root{
--bg:#0b0f14; --panel:#151c24; --text:#e6edf3; --muted:#8b98a5;
--accent:#ffb347; --good:#3fb950; --bad:#f85149; --chip:#f0c674;
--border:#2a333d;
}
*{box-sizing:border-box}
body{
margin:0; background:var(--bg); color:var(--text);
font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}
button{font:inherit; border:none; border-radius:8px; cursor:pointer; background:var(--panel); color:var(--text); padding:10px 14px}
button:active{transform:translateY(1px)}
.hidden{display:none!important}
#phoneControls{max-width:720px; margin:0 auto; padding:12px}
#tvDisplay{display:none; min-height:100vh; padding:24px}
body.console-mode #phoneControls{display:block}
body.console-mode #tvDisplay{display:none}
body.tv-mode #phoneControls{display:none}
body.tv-mode #tvDisplay{display:block}
@media(min-width:1000px){
body:not(.console-mode) #phoneControls{display:none}
body:not(.console-mode) #tvDisplay{display:block}
}
header{display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px}
header h1{font-size:1.5rem; margin:0}
#potAmount{font-weight:bold; color:var(--accent)}
#currentTurnCard{
background:var(--panel); border:1px solid var(--border); border-radius:12px;
padding:16px; margin-bottom:16px;
}
#roundLabel{font-size:1rem; color:var(--muted)}
#currentPlayerLabel{font-size:2rem; font-weight:bold; margin:4px 0}
#timerDisplay{font-size:3rem; font-weight:bold; color:var(--accent); margin:8px 0}
#timerButtons{display:flex; gap:8px; margin-bottom:12px}
#shotsButtons{display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:12px}
.shot-btn{font-size:1.5rem; padding:14px; background:#1f2a35}
.shot-btn.warn{background:#3a2a1a; color:var(--bad)}
#lastEvent{color:var(--muted); margin-bottom:12px; min-height:1.5em}
#undoBtn, #endNightBtn{width:100%; margin-bottom:8px}
#endNightBtn{background:#3a1a1a; color:var(--bad)}
#scoreboard{overflow-x:auto; margin-bottom:16px}
table{width:100%; border-collapse:collapse; font-size:0.9rem}
th,td{padding:8px 10px; border-bottom:1px solid var(--border); text-align:left; white-space:nowrap}
th{color:var(--muted); font-weight:500}
tr.current{background:#1f2a35; outline:2px solid var(--accent)}
tr.out{opacity:0.4}
.chips{letter-spacing:2px; color:var(--chip)}
.chip-num{color:var(--muted); margin-left:6px}
#eventLog{background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:12px; max-height:200px; overflow-y:auto}
#eventLog div{padding:4px 0; border-bottom:1px solid #1a222b; color:var(--muted)}
#eventLog div:first-child{color:var(--text)}
#payoutOverlay{
position:fixed; inset:0; background:rgba(0,0,0,0.7);
display:flex; align-items:center; justify-content:center; z-index:10;
}
.payout-card{
background:var(--panel); border:1px solid var(--border); border-radius:16px;
padding:24px; max-width:400px; width:90%;
}
.payout-card h2{margin-top:0}
.payout-row{display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--border)}
.payout-row strong{color:var(--accent)}
#closePayouts{width:100%; margin-top:16px}
/* TV */
#tvDisplay{font-size:1.5rem}
#tvDisplay header{font-size:2rem}
#tvCurrent{display:flex; gap:3rem; align-items:baseline; margin:24px 0}
#tvRound{font-size:2rem; color:var(--muted)}
#tvPlayer{font-size:6rem; font-weight:bold; color:var(--accent); line-height:1}
#tvTimer{font-size:5rem; font-weight:bold; color:var(--text)}
#tvLastEvent{font-size:1.5rem; color:var(--muted); margin-bottom:24px; min-height:2em}
#tvScoreboard table{font-size:1.5rem}
#tvScoreboard th,#tvScoreboard td{padding:12px 16px}
#tvScoreboard tr.current{background:#1f2a35; outline:3px solid var(--accent)}
#tvScoreboard .chips{font-size:1.8rem}
</style>
</head>
<body class="console-mode">
<div id="phoneControls">
<header>
<h1>Thursday Pool</h1>
<div>Pot $<span id="potAmount">240</span></div>
<button id="tvToggle">TV</button>
</header>
<section id="currentTurnCard">
<div id="roundLabel">Round 3</div>
<div id="currentPlayerLabel">Rico</div>
<div id="timerDisplay">1:30</div>
<div id="timerButtons">
<button id="pauseTimerBtn">Pause</button>
<button id="clockPenaltyBtn">Clock ran out</button>
</div>
<div id="shotsButtons">
<button class="shot-btn" data-shots="1">1</button>
<button class="shot-btn" data-shots="2">2</button>
<button class="shot-btn" data-shots="3">3</button>
<button class="shot-btn" data-shots="4">4</button>
<button class="shot-btn warn" data-shots="5">5</button>
<button class="shot-btn warn" data-shots="6">6</button>
<button class="shot-btn warn" data-shots="7">7</button>
<button class="shot-btn warn" data-shots="8">8</button>
</div>
<div id="lastEvent"></div>
<button id="undoBtn">Undo</button>
<button id="endNightBtn">End night & payouts</button>
</section>
<section id="scoreboard"></section>
<section id="eventLog"></section>
</div>
<div id="tvDisplay">
<header>
<div>THURSDAY POOL</div>
<div>Pot $<span id="tvPot">240</span></div>
<button id="consoleToggle">Console</button>
<button id="fullscreenBtn">Fullscreen</button>
</header>
<div id="tvCurrent">
<div id="tvRound">Round 3</div>
<div id="tvPlayer">Rico</div>
<div id="tvTimer">1:30</div>
</div>
<div id="tvLastEvent"></div>
<div id="tvScoreboard"></div>
</div>
<div id="payoutOverlay" class="hidden">
<div class="payout-card">
<h2>Payouts</h2>
<div id="payoutList"></div>
<button id="closePayouts">Close</button>
</div>
</div>
<script>
(function(){
const DEFAULT_TIMER = 90;
let state = {
players: [
{name:'Mike', chips:5, scores:[3,4], status:'active'},
{name:'Sully', chips:4, scores:[5,3], status:'active'},
{name:'Dre', chips:5, scores:[2,3], status:'active'},
{name:'Tommy', chips:5, scores:[4,4], status:'active'},
{name:'Jess', chips:4, scores:[6,2], status:'active'},
{name:'Rico', chips:5, scores:[3,5], status:'active'},
{name:'Nate', chips:5, scores:[4,3], status:'active'},
{name:'Eli', chips:4, scores:[5,5], status:'active'},
{name:'Sam', chips:5, scores:[2,4], status:'active'},
{name:'Carla', chips:4, scores:[7,3], status:'active'},
{name:'Dev', chips:5, scores:[3,2], status:'active'},
{name:'Lou', chips:4, scores:[4,6], status:'active'}
],
currentRound: 3,
currentPlayer: 5,
timerDuration: DEFAULT_TIMER,
turnStart: Date.now(),
timerRunning: true,
timerRemaining: DEFAULT_TIMER,
history: [],
events: [],
eliminatedOrder: [],
earlyLeader: null,
payouts: null
};
let endConfirm = false;
let payoutDismissed = false;
function deepClone(obj){ return JSON.parse(JSON.stringify(obj)); }
function currentPlayer(){ return state.players[state.currentPlayer]; }
function activePlayers(s){ return s.players.filter(p=>p.status==='active'); }
function total(p){ return p.scores.reduce((a,b)=>a+(b||0),0); }
function computeEarlyLeader(s){
const actives = activePlayers(s);
let best = null;
for(const p of actives){
const t = p.scores.slice(0,2).reduce((a,b)=>a+(b||0),0);
if(best === null || t < best.total) best = {name:p.name, total:t};
}
return best;
}
state.earlyLeader = computeEarlyLeader(state);
state.events = ['Game already in progress. Round 3, Rico shooting.'];
function saveHistory(){
state.history.push(deepClone(state));
if(state.history.length > 100) state.history.shift();
}
function addEvent(msg){
state.events.unshift(msg);
if(state.events.length > 50) state.events.pop();
}
function getRemaining(){
if(!state.timerRunning) return state.timerRemaining;
return Math.max(0, state.timerDuration - (Date.now() - state.turnStart)/1000);
}
function formatTime(sec){
const s = Math.max(0, Math.ceil(sec));
const m = Math.floor(s/60);
const r = s%60;
return m + ':' + r.toString().padStart(2,'0');
}
function resetTimer(){
state.turnStart = Date.now();
state.timerRemaining = state.timerDuration;
state.timerRunning = true;
}
function pauseTimer(){
if(state.timerRunning){
state.timerRemaining = getRemaining();
state.timerRunning = false;
}
}
function resumeTimer(){
if(!state.timerRunning && !state.payouts){
state.turnStart = Date.now() - (state.timerDuration - state.timerRemaining)*1000;
state.timerRunning = true;
}
}
function advance(){
const actives = activePlayers(state);
if(actives.length <= 1){ endNight(); return; }
let idx = state.currentPlayer;
let round = state.currentRound;
for(let i=1; i<=state.players.length; i++){
const next = (idx + i) % state.players.length;
if(state.players[next].status === 'active'){
if(next <= idx) round++;
state.currentPlayer = next;
state.currentRound = round;
resetTimer();
return;
}
}
endNight();
}
function enterShots(n){
if(state.payouts) return;
saveHistory();
const p = currentPlayer();
while(p.scores.length < state.currentRound) p.scores.push(null);
p.scores[state.currentRound - 1] = n;
if(n > 4){
p.chips -= 1;
addEvent(p.name + ' cleared in ' + n + ' shots and lost a chip.');
}else{
addEvent(p.name + ' cleared in ' + n + ' shots.');
}
if(p.chips <= 0){
p.status = 'out';
state.eliminatedOrder.push(p);
addEvent(p.name + ' is out of chips.');
}
advance();
render();
}
function clockPenalty(){
if(state.payouts) return;
saveHistory();
const p = currentPlayer();
p.chips -= 1;
addEvent('Clock ran out on ' + p.name + ' — lost a chip.');
if(p.chips <= 0){
p.status = 'out';
state.eliminatedOrder.push(p);
addEvent(p.name + ' is out of chips.');
}
advance();
render();
}
function endNight(){
if(state.payouts) return;
const actives = activePlayers(state);
const winner = actives[0] || state.eliminatedOrder[state.eliminatedOrder.length-1] || state.players[0];
const second = state.eliminatedOrder[state.eliminatedOrder.length-1] || null;
const pot = state.players.length * 20;
const early = state.earlyLeader;
const payouts = [];
if(early) payouts.push({name:early.name, reason:'Early leader', amount:20});
const remaining = pot - (early ? 20 : 0);
let winnerAmount = Math.round(remaining * 0.7);
let secondAmount = remaining - winnerAmount;
if(second && second !== winner){
payouts.push({name:winner.name, reason:'Winner', amount:winnerAmount});
payouts.push({name:second.name, reason:'Second', amount:secondAmount});
}else{
winnerAmount += secondAmount;
payouts.push({name:winner.name, reason:'Winner', amount:winnerAmount});
}
state.payouts = payouts;
addEvent('Night over. ' + winner.name + ' wins $' + winnerAmount + '.' +
(second && second !== winner ? ' ' + second.name + ' takes $' + secondAmount + '.' : '') +
(early ? ' ' + early.name + ' takes $20 early leader.' : ''));
render();
}
function undo(){
if(state.history.length === 0) return;
state = state.history.pop();
payoutDismissed = false;
render();
}
function chipsDots(n, isTV){
const filled = '●'.repeat(Math.max(0,n)) + '○'.repeat(Math.max(0,5-n));
return '<span class="chips">' + filled + '</span><span class="chip-num">' + n + '</span>';
}
function renderScoreboard(container, isTV){
const players = [...state.players].sort((a,b)=>{
const ta = total(a), tb = total(b);
if(ta !== tb) return ta - tb;
return b.chips - a.chips;
});
let html = '<table><thead><tr><th>#</th><th>Player</th><th>Chips</th>';
for(let r=1; r<=state.currentRound; r++) html += '<th>R' + r + '</th>';
html += '<th>Total</th></tr></thead><tbody>';
players.forEach((p, i)=>{
const isCur = state.players.indexOf(p) === state.currentPlayer && p.status === 'active';
const cls = p.status === 'out' ? 'out' : (isCur ? 'current' : '');
html += '<tr class="' + cls + '"><td>' + (i+1) + '</td><td>' + p.name + '</td><td>' + chipsDots(p.chips, isTV) + '</td>';
for(let r=1; r<=state.currentRound; r++){
const val = p.scores[r-1];
html += '<td>' + (val === undefined || val === null ? '—' : val) + '</td>';
}
html += '<td>' + total(p) + '</td></tr>';
});
html += '</tbody></table>';
container.innerHTML = html;
}
function render(){
const p = currentPlayer();
document.getElementById('potAmount').textContent = state.players.length * 20;
document.getElementById('tvPot').textContent = state.players.length * 20;
document.getElementById('roundLabel').textContent = 'Round ' + state.currentRound;
document.getElementById('currentPlayerLabel').textContent = p ? p.name : '—';
const rem = getRemaining();
document.getElementById('timerDisplay').textContent = formatTime(rem);
document.getElementById('tvTimer').textContent = formatTime(rem);
document.getElementById('pauseTimerBtn').textContent = state.timerRunning ? 'Pause' : 'Resume';
document.getElementById('lastEvent').textContent = state.events[0] || '';
document.getElementById('tvLastEvent').textContent = state.events[0] || '';
document.getElementById('tvRound').textContent = 'Round ' + state.currentRound;
document.getElementById('tvPlayer').textContent = p ? p.name : '—';
renderScoreboard(document.getElementById('scoreboard'), false);
renderScoreboard(document.getElementById('tvScoreboard'), true);
document.getElementById('eventLog').innerHTML = state.events.slice(0,8).map(e => '<div>' + e + '</div>').join('');
const overlay = document.getElementById('payoutOverlay');
if(state.payouts && !payoutDismissed){
overlay.classList.remove('hidden');
document.getElementById('payoutList').innerHTML = state.payouts.map(p =>
'<div class="payout-row"><span>' + p.reason + '</span><strong>' + p.name + '</strong><span>$' + p.amount + '</span></div>'
).join('');
}else{
overlay.classList.add('hidden');
}
}
document.querySelectorAll('.shot-btn').forEach(btn => {
btn.addEventListener('click', () => enterShots(parseInt(btn.dataset.shots, 10)));
});
document.getElementById('clockPenaltyBtn').addEventListener('click', clockPenalty);
document.getElementById('pauseTimerBtn').addEventListener('click', () => {
if(state.timerRunning) pauseTimer(); else resumeTimer();
render();
});
document.getElementById('undoBtn').addEventListener('click', undo);
document.getElementById('endNightBtn').addEventListener('click', () => {
if(state.payouts) return;
if(activePlayers(state).length > 1 && !endConfirm){
endConfirm = true;
const btn = document.getElementById('endNightBtn');
btn.textContent = 'Tap again to confirm end';
setTimeout(() => { endConfirm = false; btn.textContent = 'End night & payouts'; }, 3000);
return;
}
endNight();
});
document.getElementById('tvToggle').addEventListener('click', () => {
document.body.classList.remove('console-mode');
document.body.classList.add('tv-mode');
});
document.getElementById('consoleToggle').addEventListener('click', () => {
document.body.classList.remove('tv-mode');
document.body.classList.add('console-mode');
});
document.getElementById('fullscreenBtn').addEventListener('click', () => {
if(document.documentElement.requestFullscreen) document.documentElement.requestFullscreen();
});
document.getElementById('closePayouts').addEventListener('click', () => {
payoutDismissed = true;
document.getElementById('payoutOverlay').classList.add('hidden');
});
setInterval(() => {
if(state.payouts) return;
if(state.timerRunning){
const rem = getRemaining();
if(rem <= 0){
state.timerRunning = false;
clockPenalty();
}else{
document.getElementById('timerDisplay').textContent = formatTime(rem);
document.getElementById('tvTimer').textContent = formatTime(rem);
}
}
}, 250);
if(window.innerWidth >= 1000){
document.body.classList.remove('console-mode');
document.body.classList.add('tv-mode');
}
render();
})();
</script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Thursday Pool Playback</title>
<style>
:root{
--bg:#0b0f14; --panel:#151c24; --text:#e6edf3; --muted:#8b98a5;
--accent:#ffb347; --good:#3fb950; --bad:#f85149; --chip:#f0c674;
--border:#2a333d;
}
*{box-sizing:border-box}
body{
margin:0; background:var(--bg); color:var(--text);
font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
padding:16px;
}
button{font:inherit; border:none; border-radius:8px; cursor:pointer; background:var(--panel); color:var(--text); padding:10px 14px}
button:active{transform:translateY(1px)}
.hidden{display:none!important}
header{display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px}
header h1{font-size:1.5rem; margin:0}
#controls{display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:16px}
#controls button{font-size:1rem}
#speedWrap{display:flex; align-items:center; gap:8px}
#currentEvent{
background:var(--panel); border:1px solid var(--border); border-radius:12px;
padding:16px; margin-bottom:16px; font-size:1.2rem; min-height:3em;
}
#scoreboard{overflow-x:auto; margin-bottom:16px}
table{width:100%; border-collapse:collapse; font-size:0.9rem}
th,td{padding:8px 10px; border-bottom:1px solid var(--border); text-align:left; white-space:nowrap}
th{color:var(--muted); font-weight:500}
tr.current{background:#1f2a35; outline:2px solid var(--accent)}
tr.out{opacity:0.4}
.chips{letter-spacing:2px; color:var(--chip)}
.chip-num{color:var(--muted); margin-left:6px}
#eventLog{background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:12px; max-height:300px; overflow-y:auto}
#eventLog div{padding:4px 0; border-bottom:1px solid #1a222b; color:var(--muted)}
#eventLog div:first-child{color:var(--text)}
#payoutOverlay{
position:fixed; inset:0; background:rgba(0,0,0,0.7);
display:flex; align-items:center; justify-content:center; z-index:10;
}
.payout-card{
background:var(--panel); border:1px solid var(--border); border-radius:16px;
padding:24px; max-width:400px; width:90%;
}
.payout-card h2{margin-top:0}
.payout-row{display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--border)}
.payout-row strong{color:var(--accent)}
#closePayouts{width:100%; margin-top:16px}
</style>
</head>
<body>
<header>
<h1>Playback — Thursday Pool</h1>
<div id="progress">Step 0 / 0</div>
</header>
<div id="controls">
<button id="playPauseBtn">Play</button>
<button id="stepBackBtn">Step Back</button>
<button id="stepForwardBtn">Step Forward</button>
<button id="resetBtn">Reset</button>
<div id="speedWrap">
<label for="speedSlider">Speed</label>
<input type="range" id="speedSlider" min="0.5" max="10" step="0.5" value="1">
<span id="speedLabel">1x</span>
</div>
</div>
<div id="currentEvent">Night starts.</div>
<div id="scoreboard"></div>
<div id="eventLog"></div>
<div id="payoutOverlay" class="hidden">
<div class="payout-card">
<h2>Payouts</h2>
<div id="payoutList"></div>
<button id="closePayouts">Close</button>
</div>
</div>
<script>
(function(){
const seed = 42;
function mulberry32(a){
return function(){
a |= 0; a = a + 0x6D2B79F5 | 0;
let t = Math.imul(a ^ a >>> 15, 1 | a);
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
return ((t ^ t >>> 14) >>> 0) / 4294967296;
};
}
const rng = mulberry32(seed);
function deepClone(obj){ return JSON.parse(JSON.stringify(obj)); }
function total(p){ return p.scores.reduce((a,b)=>a+(b||0),0); }
function activePlayers(s){ return s.players.filter(p=>p.status==='active'); }
function computeEarlyLeader(s){
const actives = activePlayers(s);
let best = null;
for(const p of actives){
const t = p.scores.slice(0,2).reduce((a,b)=>a+(b||0),0);
if(best === null || t < best.total) best = {name:p.name, total:t};
}
return best;
}
function createInitialState(){
const names = ['Mike','Sully','Dre','Tommy','Jess','Rico','Nate','Eli','Sam','Carla','Dev','Lou'];
return {
players: names.map(name => ({name, chips:5, scores:[], status:'active'})),
currentRound: 1,
currentPlayer: 0,
timerDuration: 90,
turnStart: Date.now(),
timerRunning: true,
timerRemaining: 90,
history: [],
events: [],
eliminatedOrder: [],
earlyLeader: null,
payouts: null
};
}
function advance(state){
const actives = activePlayers(state);
if(actives.length <= 1){ endNight(state); return; }
let idx = state.currentPlayer;
let round = state.currentRound;
for(let i=1; i<=state.players.length; i++){
const next = (idx + i) % state.players.length;
if(state.players[next].status === 'active'){
if(next <= idx) round++;
state.currentPlayer = next;
state.currentRound = round;
return;
}
}
endNight(state);
}
function applyShots(state, playerIndex, shots){
const p = state.players[playerIndex];
while(p.scores.length < state.currentRound) p.scores.push(null);
p.scores[state.currentRound - 1] = shots;
if(shots > 4) p.chips -= 1;
if(p.chips <= 0){
p.status = 'out';
state.eliminatedOrder.push(p);
}
advance(state);
}
function applyClockPenalty(state, playerIndex){
const p = state.players[playerIndex];
p.chips -= 1;
if(p.chips <= 0){
p.status = 'out';
state.eliminatedOrder.push(p);
}
advance(state);
}
function endNight(state){
if(state.payouts) return;
const actives = activePlayers(state);
const winner = actives[0] || state.eliminatedOrder[state.eliminatedOrder.length-1] || state.players[0];
const second = state.eliminatedOrder[state.eliminatedOrder.length-1] || null;
const pot = state.players.length * 20;
const early = state.earlyLeader;
const payouts = [];
if(early) payouts.push({name:early.name, reason:'Early leader', amount:20});
const remaining = pot - (early ? 20 : 0);
let winnerAmount = Math.round(remaining * 0.7);
let secondAmount = remaining - winnerAmount;
if(second && second !== winner){
payouts.push({name:winner.name, reason:'Winner', amount:winnerAmount});
payouts.push({name:second.name, reason:'Second', amount:secondAmount});
}else{
winnerAmount += secondAmount;
payouts.push({name:winner.name, reason:'Winner', amount:winnerAmount});
}
state.payouts = payouts;
}
function weightedShots(){
const r = rng();
if(r < 0.05) return 1;
if(r < 0.20) return 2;
if(r < 0.50) return 3;
if(r < 0.75) return 4;
if(r < 0.90) return 5;
if(r < 0.97) return 6;
return 7;
}
function generateNight(){
const state = createInitialState();
const snapshots = [deepClone(state)];
const events = ['Night starts. 12 players, $240 pot.'];
let current = 0;
let safety = 0;
while(activePlayers(state).length > 1 && safety < 1000){
safety++;
const p = state.players[current];
if(p.status !== 'active'){
current = (current + 1) % state.players.length;
continue;
}
if(rng() < 0.07){
applyClockPenalty(state, current);
events.push('Clock ran out on ' + p.name + ' — lost a chip.' + (p.chips <= 0 ? ' Out of chips.' : ''));
snapshots.push(deepClone(state));
current = state.currentPlayer;
continue;
}
const shots = weightedShots();
applyShots(state, current, shots);
events.push(p.name + ' cleared in ' + shots + ' shots' + (shots > 4 ? ' and lost a chip' : '') + '.' + (p.chips <= 0 ? ' Out of chips.' : ''));
snapshots.push(deepClone(state));
current = state.currentPlayer;
if(state.currentRound > 2 && !state.earlyLeader){
state.earlyLeader = computeEarlyLeader(state);
events.push('Early leader after round 2: ' + state.earlyLeader.name + ' (' + state.earlyLeader.total + ' strokes).');
snapshots.push(deepClone(state));
}
}
endNight(state);
events.push('Night over. Payouts: ' + state.payouts.map(p => p.name + ' $' + p.amount + ' (' + p.reason + ')').join(', '));
snapshots.push(deepClone(state));
return { snapshots, events };
}
const { snapshots, events } = generateNight();
let currentStep = 0;
let playing = false;
let playInterval = null;
let speed = 1;
let payoutDismissed = false;
function chipsDots(n){
const filled = '●'.repeat(Math.max(0,n)) + '○'.repeat(Math.max(0,5-n));
return '<span class="chips">' + filled + '</span><span class="chip-num">' + n + '</span>';
}
function renderScoreboard(state){
const players = [...state.players].sort((a,b)=>{
const ta = total(a), tb = total(b);
if(ta !== tb) return ta - tb;
return b.chips - a.chips;
});
let html = '<table><thead><tr><th>#</th><th>Player</th><th>Chips</th>';
for(let r=1; r<=state.currentRound; r++) html += '<th>R' + r + '</th>';
html += '<th>Total</th></tr></thead><tbody>';
players.forEach((p, i)=>{
const isCur = state.players.indexOf(p) === state.currentPlayer && p.status === 'active';
const cls = p.status === 'out' ? 'out' : (isCur ? 'current' : '');
html += '<tr class="' + cls + '"><td>' + (i+1) + '</td><td>' + p.name + '</td><td>' + chipsDots(p.chips) + '</td>';
for(let r=1; r<=state.currentRound; r++){
const val = p.scores[r-1];
html += '<td>' + (val === undefined || val === null ? '—' : val) + '</td>';
}
html += '<td>' + total(p) + '</td></tr>';
});
html += '</tbody></table>';
return html;
}
function render(){
const state = snapshots[currentStep];
document.getElementById('progress').textContent = 'Step ' + currentStep + ' / ' + (snapshots.length - 1);
document.getElementById('currentEvent').textContent = events[currentStep] || '';
document.getElementById('scoreboard').innerHTML = renderScoreboard(state);
document.getElementById('eventLog').innerHTML = events.slice(0, currentStep + 1).reverse().map(e => '<div>' + e + '</div>').join('');
document.getElementById('playPauseBtn').textContent = playing ? 'Pause' : 'Play';
document.getElementById('speedLabel').textContent = speed + 'x';
const overlay = document.getElementById('payoutOverlay');
if(state.payouts && !payoutDismissed){
overlay.classList.remove('hidden');
document.getElementById('payoutList').innerHTML = state.payouts.map(p =>
'<div class="payout-row"><span>' + p.reason + '</span><strong>' + p.name + '</strong><span>$' + p.amount + '</span></div>'
).join('');
}else{
overlay.classList.add('hidden');
}
}
function pause(){
playing = false;
clearInterval(playInterval);
render();
}
function play(){
if(currentStep >= snapshots.length - 1) currentStep = 0;
playing = true;
clearInterval(playInterval);
playInterval = setInterval(() => {
if(currentStep < snapshots.length - 1){
currentStep++;
render();
}else{
pause();
}
}, 2000 / speed);
render();
}
function stepForward(){
pause();
if(currentStep < snapshots.length - 1){
currentStep++;
render();
}
}
function stepBack(){
pause();
if(currentStep > 0){
currentStep--;
render();
}
}
function reset(){
pause();
currentStep = 0;
payoutDismissed = false;
render();
}
document.getElementById('playPauseBtn').addEventListener('click', () => {
if(playing) pause(); else play();
});
document.getElementById('stepForwardBtn').addEventListener('click', stepForward);
document.getElementById('stepBackBtn').addEventListener('click', stepBack);
document.getElementById('resetBtn').addEventListener('click', reset);
document.getElementById('speedSlider').addEventListener('input', (e) => {
speed = parseFloat(e.target.value);
if(playing){
clearInterval(playInterval);
playInterval = setInterval(() => {
if(currentStep < snapshots.length - 1){
currentStep++;
render();
}else{
pause();
}
}, 2000 / speed);
}
render();
});
document.getElementById('closePayouts').addEventListener('click', () => {
payoutDismissed = true;
document.getElementById('payoutOverlay').classList.add('hidden');
});
render();
})();
</script>
</body>
</html>