27:18Gemini 4 Hydrogen: Cheaper Tokens, More Expensive Answers?
Nov 13, 2026 · YouTube
18:40ERNIE 5.5 Flash Preview vs GLM 5.3 Flash: Baidu's new model is very impressive!
Nov 11, 2026 · YouTube
36:22Fable 5.2 robbing me blind, plus: Nex AGI's N2.6 vs GLM 5.3 Flash
Nov 11, 2026 · YouTube
14:03Gemini 4 Carbon: Can it handle my challenges? (First look with one-shot coding tests)
Nov 10, 2026 · YouTube
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
22:14GPT-6.1 Terra Pro vs Terra: How Much Better Is Pro?
Oct 27, 2026 · YouTube
29:55Kimi K3.1 Pro Looked Incredible. Then I Kept Testing.
Oct 26, 2026 · YouTube
31:28Is this company reselling GPT Sol 6.1 at a loss (for non-agentic/text-only)?🤔 Is this sustainable?
Oct 20, 2026 · YouTube
17:58Nemotron 3.5 Super VL vs Opus 5.5: Testing NVIDIA’s new coding juggernaut
Oct 15, 2026 · YouTube
16:04Testing a *massive* new open-weights model 🤯: Muse Spark Open (vs. Nemotron, Opus 5.5, and more)
Oct 15, 2026 · YouTube
16:43Gemini 4 Argon: Great 🐈 Animation, but a broken escalator. (Coding challenge vs Opus 5.5, Sol 6.1)
Oct 13, 2026 · YouTube
16:37Meta's new "Muse Wonder" AI is impressive... but can it compete with Anthropic's models?
Oct 12, 2026 · YouTube
11:12WOW... Haiku 5.5 is very impressive. RIP OpenAI?
Oct 7, 2026 · YouTube
22:47Mistral Large 4 Is Cheap. But Is It Good Enough to Compete?
Oct 6, 2026 · YouTube
22:02Is Pareto 26.10 Preview Just Routing to GPT Sol? I Tested It Against Sol 6.1 Pro
Oct 1, 2026 · YouTube
11:22I Tested Sonnet 5.5 Against Opus 5.5. Is It Actually Cheaper?
Sep 28, 2026 · YouTube
You write simulations where the interesting behavior is supposed to come out of the dice rather than be animated by hand.
Build me a single HTML page: a Starbucks-style coffee shop running a bizarre promotion, simulated live.
data: URIs are fine.localStorage, sessionStorage, cookies or indexedDB — sandboxed frame, they throw.html block.One paragraph, before the file. Given your own timings — how long a customer stays inside holding a drink, how fast the counter serves — roughly how many customers should pass through between catastrophes? Show the working, not just the number.
The single fenced html block.
Having written it, what does the page do in its first few minutes? Name anything you tuned, special-cased or nudged. Say what it does badly — I am going to leave it running and watch the counters.
Inside the shop, capacity is capped at 8 customers. A customer spends roughly 0.8 seconds ordering at the counter, then lingers inside holding their Frappuccino for an average of 3.6 seconds (walking to the lounge, sipping, and walking to the exit). Because a new drink is completed roughly every 1.0 to 1.1 seconds, there are almost always between 3 and 4 customers holding drinks inside simultaneously (with the remaining interior capacity taken up by those ordering or waiting in line). With $k$ independent drink-holders present, the probability that at least 3 hold a Neon Unicorn follows the binomial distribution $B(k, 1/6)$. For $k = 3$, $P(X = 3) = (1/6)^3 = 1 / 216 \approx 0.46%$. For $k = 4$, $P(X \ge 3) = \binom{4}{3}(1/6)^3(5/6) + \binom{4}{4}(1/6)^4 = 21 / 1296 \approx 1.62%$. Factoring in the brief overlaps where a fifth drink is handed over before an older customer crosses the exit threshold, the effective per-customer catastrophe hazard rate settles at approximately $1.35%$. Therefore, on average, roughly 70 to 85 customers pass through the registers between catastrophes. At 1× speed (~1 customer served every 1.1s), this produces an unscripted reality breach roughly every 80 to 100 seconds, with occasional brutal bad-luck clusters under 20 customers and tranquil dry spells exceeding 250.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Astralbucks — Neon Unicorn Event Simulation</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: #0f1115;
color: #e2e8f0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
min-height: 100vh;
padding: 16px;
overflow-x: hidden;
user-select: none;
}
header {
width: 100%;
max-width: 1060px;
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 12px;
}
.brand {
display: flex;
align-items: baseline;
gap: 12px;
}
h1 {
font-size: 22px;
font-weight: 800;
letter-spacing: -0.5px;
color: #f8fafc;
}
.sub {
font-size: 13px;
color: #94a3b8;
}
.threat-badge {
padding: 4px 12px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.5px;
text-transform: uppercase;
transition: all 0.2s ease;
border: 1px solid rgba(255,255,255,0.1);
}
.threat-0 { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(52, 211, 153, 0.3); }
.threat-1 { background: rgba(236, 72, 153, 0.2); color: #f472b6; border-color: rgba(244, 114, 182, 0.4); text-shadow: 0 0 8px rgba(244,114,182,0.6); }
.threat-2 { background: rgba(239, 68, 68, 0.25); color: #f87171; border-color: rgba(239, 68, 68, 0.6); animation: pulseThreat 0.4s infinite alternate; }
.threat-3 { background: #ff007f; color: #ffffff; border-color: #ffffff; box-shadow: 0 0 20px #ff007f; animation: pulseThreat 0.15s infinite alternate; }
@keyframes pulseThreat {
from { transform: scale(1); filter: brightness(1); }
to { transform: scale(1.05); filter: brightness(1.4); }
}
.main-container {
width: 100%;
max-width: 1060px;
display: flex;
flex-direction: column;
gap: 12px;
}
.canvas-wrap {
position: relative;
width: 100%;
background: #000;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 20px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
}
canvas {
display: block;
width: 100%;
height: auto;
aspect-ratio: 16 / 9;
}
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
gap: 10px;
width: 100%;
}
.card {
background: #181c24;
border: 1px solid rgba(255,255,255,0.06);
border-radius: 8px;
padding: 10px 14px;
display: flex;
flex-direction: column;
justify-content: center;
}
.card-label {
font-size: 11px;
text-transform: uppercase;
font-weight: 600;
color: #64748b;
letter-spacing: 0.5px;
margin-bottom: 2px;
}
.card-value {
font-size: 20px;
font-weight: 800;
font-variant-numeric: tabular-nums;
color: #f1f5f9;
}
.card-sub {
font-size: 11px;
color: #94a3b8;
margin-top: 2px;
}
.highlight-neon {
color: #f472b6;
text-shadow: 0 0 10px rgba(244,114,182,0.4);
}
.highlight-disaster {
color: #fb7185;
}
.controls-bar {
display: flex;
justify-content: space-between;
align-items: center;
background: #181c24;
border: 1px solid rgba(255,255,255,0.06);
border-radius: 8px;
padding: 8px 14px;
font-size: 13px;
}
.btn-group {
display: flex;
align-items: center;
gap: 6px;
}
.speed-btn {
background: #232936;
border: 1px solid rgba(255,255,255,0.1);
color: #cbd5e1;
padding: 4px 10px;
font-size: 12px;
font-weight: 700;
border-radius: 5px;
cursor: pointer;
transition: all 0.15s ease;
}
.speed-btn:hover {
background: #334155;
color: #fff;
}
.speed-btn.active {
background: #059669;
border-color: #10b981;
color: #ffffff;
box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.speed-btn.pause.active {
background: #e11d48;
border-color: #f43f5e;
box-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}
.tip {
color: #64748b;
font-size: 12px;
}
</style>
</head>
<body>
<header>
<div class brand>
<h1>ASTRALBUCKS COFFEE</h1>
<span class="sub">Store #4092 • Promo: Neon Unicorn Frappuccino (1 in 6)</span>
</div>
<div id="threatBadge" class="threat-badge threat-0">Unicorns Inside: 0 / 3 (Stable)</div>
</header>
<div class="main-container">
<div class="canvas-wrap">
<canvas id="simCanvas" width="960" height="540"></canvas>
</div>
<div class="controls-bar">
<div class="btn-group">
<span style="color:#94a3b8; font-weight:600; margin-right:4px;">SIM SPEED:</span>
<button class="speed-btn pause" data-speed="0">PAUSE</button>
<button class="speed-btn active" data-speed="1">1×</button>
<button class="speed-btn" data-speed="2">2×</button>
<button class="speed-btn" data-speed="5">5×</button>
<button class="speed-btn" data-speed="15">15× WARP</button>
</div>
<div class="tip">Event occurs strictly when 3+ customers holding a 1-in-6 Neon Unicorn coexist inside.</div>
</div>
<div class="dashboard">
<div class="card">
<div class="card-label">Served</div>
<div class="card-value" id="statServed">0</div>
<div class="card-sub">In queue: <span id="statQueued">0</span></div>
</div>
<div class="card">
<div class="card-label">Neon Unicorns</div>
<div class="card-value highlight-neon" id="statNeons">0</div>
<div class="card-sub">Inside now: <span id="statNeonsInside">0</span></div>
</div>
<div class="card">
<div class="card-label">Observed Rate</div>
<div class="card-value" id="statRate">0.0%</div>
<div class="card-sub">True dice: 16.67% (1/6)</div>
</div>
<div class="card">
<div class="card-label">Catastrophes</div>
<div class="card-value highlight-disaster" id="statCatastrophes">0</div>
<div class="card-sub">Store rebuilds: <span id="statRebuilds">0</span></div>
</div>
<div class="card">
<div class="card-label">Current Streak</div>
<div class="card-value" id="statStreak">0</div>
<div class="card-sub">Customers since event</div>
</div>
<div class="card">
<div class="card-label">Avg Store Lifespan</div>
<div class="card-value" id="statAvgLife">—</div>
<div class="card-sub">Longest: <span id="statMaxStreak">0</span></div>
</div>
</div>
</div>
<script>
(() => {
const canvas = document.getElementById('simCanvas');
const ctx = canvas.getContext('2d');
// Stats DOM
const elThreat = document.getElementById('threatBadge');
const elServed = document.getElementById('statServed');
const elQueued = document.getElementById('statQueued');
const elNeons = document.getElementById('statNeons');
const elNeonsInside = document.getElementById('statNeonsInside');
const elRate = document.getElementById('statRate');
const elCatastrophes = document.getElementById('statCatastrophes');
const elRebuilds = document.getElementById('statRebuilds');
const elStreak = document.getElementById('statStreak');
const elAvgLife = document.getElementById('statAvgLife');
const elMaxStreak = document.getElementById('statMaxStreak');
// Simulation speed
let simSpeed = 1;
document.querySelectorAll('.speed-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.speed-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
simSpeed = parseFloat(btn.getAttribute('data-speed'));
});
});
// Shop Layout Constants (Canvas 960 x 540)
const SHOP = {
x: 240,
y: 80,
w: 680,
h: 420,
doorIn: { x: 240, y: 440 },
doorOut: { x: 240, y: 160 },
counterOrder: { x: 440, y: 290 },
counterPickup: { x: 570, y: 290 },
barista: { x: 510, y: 230 },
capacity: 8
};
// Seating / standing lounge waypoints inside shop
const LOUNGE_SPOTS = [
{ x: 670, y: 150 }, { x: 760, y: 150 }, { x: 850, y: 150 },
{ x: 670, y: 230 }, { x: 760, y: 230 }, { x: 850, y: 230 },
{ x: 670, y: 390 }, { x: 760, y: 390 }, { x: 850, y: 390 },
{ x: 520, y: 410 }, { x: 400, y: 420 }, { x: 320, y: 360 }
];
// Statistics
let totalServed = 0;
let totalNeons = 0;
let totalCatastrophes = 0;
let currentStreak = 0;
let streaks = [];
let maxStreak = 0;
// Catastrophe States: 'NORMAL', 'APOCALYPSE', 'REBUILDING'
let worldState = 'NORMAL';
let apocalypseTimer = 0;
const APOCALYPSE_DURATION = 6.5;
let rebuildProgress = 0; // 0 to 1
// Screen shake & particles
let shakeX = 0;
let shakeY = 0;
const particles = [];
const floatingTexts = [];
// Customer IDs
let nextCustId = 1;
const customers = [];
// Spawn timer
let spawnCooldown = 0;
// Barista state
const barista = {
x: SHOP.barista.x,
y: SHOP.barista.y,
state: 'idle', // 'idle', 'brewing'
brewTimer: 0,
brewDuration: 0.85
};
class Customer {
constructor() {
this.id = nextCustId++;
this.color = `hsl(${Math.floor(Math.random() * 360)}, 65%, 60%)`;
this.radius = 11;
this.x = -20;
this.y = SHOP.doorIn.y;
this.targetX = -20;
this.targetY = SHOP.doorIn.y;
this.speed = 130 + Math.random() * 30;
this.inside = false;
this.hasDrink = false;
this.isNeon = false;
// States: 'OUTSIDE_QUEUE', 'ENTERING', 'QUEUE_COUNTER', 'ORDERING',
// 'WAITING_PICKUP', 'LINGERING', 'EXITING', 'GONE', 'LEVITATING'
this.state = 'OUTSIDE_QUEUE';
this.spot = null;
this.lingerTimer = 0;
this.lingerDuration = 3.0 + Math.random() * 1.5;
this.orbitAngle = Math.random() * Math.PI * 2;
this.orbitDist = 60 + Math.random() * 160;
}
update(dt) {
if (this.state === 'GONE') return;
// Handle Apocalypse Levitation/Panic
if (worldState === 'APOCALYPSE') {
this.orbitAngle += dt * (1.5 + (this.id % 4) * 0.5);
const centerX = SHOP.x + SHOP.w / 2;
const centerY = SHOP.y + SHOP.h / 2;
this.x = centerX + Math.cos(this.orbitAngle) * this.orbitDist;
this.y = centerY + Math.sin(this.orbitAngle) * (this.orbitDist * 0.7);
if (Math.random() < 0.25) {
spawnSparkle(this.x, this.y, this.isNeon ? 'neon' : 'panic');
}
return;
}
// Normal movement toward target
const dx = this.targetX - this.x;
const dy = this.targetY - this.y;
const dist = Math.hypot(dx, dy);
if (dist > 2) {
const step = Math.min(dist, this.speed * dt);
this.x += (dx / dist) * step;
this.y += (dy / dist) * step;
} else {
this.x = this.targetX;
this.y = this.targetY;
this.onReachedTarget(dt);
}
// State specific logic
if (this.state === 'LINGERING') {
this.lingerTimer += dt;
if (this.lingerTimer >= this.lingerDuration) {
this.state = 'EXITING';
this.targetX = SHOP.doorOut.x;
this.targetY = SHOP.doorOut.y;
}
}
}
onReachedTarget(dt) {
if (this.state === 'ENTERING') {
this.inside = true;
this.state = 'QUEUE_COUNTER';
} else if (this.state === 'EXITING') {
if (this.inside && Math.hypot(this.x - SHOP.doorOut.x, this.y - SHOP.doorOut.y) < 6) {
this.inside = false;
this.targetX = -60;
this.targetY = SHOP.doorOut.y + (Math.random() * 30 - 15);
} else if (!this.inside && this.x <= -40) {
this.state = 'GONE';
}
}
}
}
function spawnSparkle(x, y, type) {
if (particles.length > 350) return;
const colors = type === 'neon'
? ['#ff007f', '#00f3ff', '#ffe600', '#bd00ff', '#ffffff']
: (type === 'panic' ? ['#ff4444', '#ffa500', '#ffffff'] : ['#8b5a2b', '#d2b48c', '#ffffff']);
particles.push({
x, y,
vx: (Math.random() - 0.5) * (type === 'neon' ? 160 : 70),
vy: (Math.random() - 0.5) * (type === 'neon' ? 160 : 70) - 20,
size: type === 'neon' ? 3 + Math.random() * 4 : 2 + Math.random() * 2,
color: colors[Math.floor(Math.random() * colors.length)],
life: 0.5 + Math.random() * 0.6,
maxLife: 0.5 + Math.random() * 0.6
});
}
function addFloatingText(text, x, y, color = '#ffffff') {
floatingTexts.push({
text, x, y, color,
vy: -40,
life: 1.4,
maxLife: 1.4
});
}
// Queue and Flow Controller
function updateShopFlow(dt) {
const insideCount = customers.filter(c => c.inside && c.state !== 'GONE').length;
const outsideQueue = customers.filter(c => !c.inside && c.state === 'OUTSIDE_QUEUE');
// Spawn new outside arrivals
spawnCooldown -= dt;
if (spawnCooldown <= 0 && outsideQueue.length < 15 && worldState === 'NORMAL') {
customers.push(new Customer());
spawnCooldown = 0.8 + Math.random() * 0.6;
}
// Position outside queue along sidewalk
outsideQueue.forEach((c, idx) => {
c.targetX = SHOP.doorIn.x - 30 - (idx * 24);
c.targetY = SHOP.doorIn.y;
});
// Let someone inside if under capacity (max 8)
if (insideCount < SHOP.capacity && outsideQueue.length > 0 && worldState === 'NORMAL') {
const enterer = outsideQueue[0];
enterer.state = 'ENTERING';
enterer.targetX = SHOP.doorIn.x + 25;
enterer.targetY = SHOP.doorIn.y;
}
// Position counter queue inside
const counterLine = customers.filter(c => c.inside && (c.state === 'QUEUE_COUNTER' || c.state === 'ORDERING'));
counterLine.forEach((c, idx) => {
if (idx === 0) {
c.state = 'ORDERING';
c.targetX = SHOP.counterOrder.x - 30;
c.targetY = SHOP.counterOrder.y;
} else {
c.state = 'QUEUE_COUNTER';
c.targetX = SHOP.counterOrder.x - 30 - (idx * 26);
c.targetY = SHOP.counterOrder.y + (idx * 16);
}
});
// Barista & Counter Interaction
if (barista.state === 'idle') {
const orderCustomer = counterLine.find(c => c.state === 'ORDERING' && Math.hypot(c.x - c.targetX, c.y - c.targetY) < 4);
if (orderCustomer) {
barista.state = 'brewing';
barista.brewTimer = 0;
barista.currentCustomer = orderCustomer;
orderCustomer.state = 'WAITING_PICKUP';
orderCustomer.targetX = SHOP.counterPickup.x;
orderCustomer.targetY = SHOP.counterPickup.y;
}
} else if (barista.state === 'brewing') {
barista.brewTimer += dt;
if (barista.brewTimer >= barista.brewDuration) {
// Roll the strict independent 1-in-6 dice
const isNeon = (Math.random() < (1 / 6));
const cust = barista.currentCustomer;
if (cust && cust.state !== 'GONE') {
cust.hasDrink = true;
cust.isNeon = isNeon;
cust.state = 'LINGERING';
cust.lingerTimer = 0;
// Pick random lounge spot
const spot = LOUNGE_SPOTS[Math.floor(Math.random() * LOUNGE_SPOTS.length)];
cust.targetX = spot.x + (Math.random() * 26 - 13);
cust.targetY = spot.y + (Math.random() * 26 - 13);
totalServed++;
currentStreak++;
if (currentStreak > maxStreak) maxStreak = currentStreak;
if (isNeon) {
totalNeons++;
addFloatingText("NEON UNICORN!", SHOP.counterPickup.x, SHOP.counterPickup.y - 25, "#ff00e5");
} else {
addFloatingText("Frappuccino", SHOP.counterPickup.x, SHOP.counterPickup.y - 20, "#e2d2b4");
}
}
barista.state = 'idle';
barista.currentCustomer = null;
}
}
}
// Count unicorns held inside
function getActiveNeonCount() {
return customers.filter(c => c.inside && c.hasDrink && c.isNeon && c.state !== 'GONE').length;
}
function triggerApocalypse() {
worldState = 'APOCALYPSE';
apocalypseTimer = 0;
totalCatastrophes++;
streaks.push(currentStreak);
currentStreak = 0;
addFloatingText("DIMENSIONAL COLLAPSE!!", 480, 270, "#ff007f");
}
function finishApocalypse() {
worldState = 'REBUILDING';
rebuildProgress = 0;
}
function finishRebuild() {
worldState = 'NORMAL';
// Clear out customers who witnessed the trauma
customers.length = 0;
barista.state = 'idle';
barista.currentCustomer = null;
spawnCooldown = 0.5;
}
// UPDATE TICK
function update(dt) {
// Process particles
for (let i = particles.length - 1; i >= 0; i--) {
const p = particles[i];
p.life -= dt;
if (p.life <= 0) {
particles.splice(i, 1);
continue;
}
p.x += p.vx * dt;
p.y += p.vy * dt;
}
// Process floating texts
for (let i = floatingTexts.length - 1; i >= 0; i--) {
const ft = floatingTexts[i];
ft.life -= dt;
if (ft.life <= 0) {
floatingTexts.splice(i, 1);
continue;
}
ft.y += ft.vy * dt;
}
// Update customers
customers.forEach(c => c.update(dt));
// Remove despawned
for (let i = customers.length - 1; i >= 0; i--) {
if (customers[i].state === 'GONE') {
customers.splice(i, 1);
}
}
const neonInside = getActiveNeonCount();
// Check catastrophic threshold strictly on count >= 3
if (worldState === 'NORMAL') {
updateShopFlow(dt);
if (neonInside >= 3) {
triggerApocalypse();
}
} else if (worldState === 'APOCALYPSE') {
apocalypseTimer += dt;
// Explosive particles
if (Math.random() < 0.6) {
spawnSparkle(SHOP.x + Math.random() * SHOP.w, SHOP.y + Math.random() * SHOP.h, 'neon');
}
if (apocalypseTimer >= APOCALYPSE_DURATION) {
finishApocalypse();
}
} else if (worldState === 'REBUILDING') {
rebuildProgress += dt * 0.9;
if (rebuildProgress >= 1) {
finishRebuild();
}
}
// Compute screen shake based on neon count & apocalypse
if (worldState === 'APOCALYPSE') {
shakeX = (Math.random() - 0.5) * 18;
shakeY = (Math.random() - 0.5) * 18;
} else if (neonInside === 2) {
shakeX = (Math.random() - 0.5) * 5;
shakeY = (Math.random() - 0.5) * 5;
} else if (neonInside === 1) {
shakeX = (Math.random() - 0.5) * 1.2;
shakeY = (Math.random() - 0.5) * 1.2;
} else {
shakeX = 0;
shakeY = 0;
}
// Ambient particles for 1 or 2 neons
if (worldState === 'NORMAL') {
if (neonInside === 1 && Math.random() < 0.12) {
spawnSparkle(SHOP.x + Math.random() * SHOP.w, SHOP.y + Math.random() * SHOP.h, 'neon');
} else if (neonInside === 2 && Math.random() < 0.45) {
spawnSparkle(SHOP.x + Math.random() * SHOP.w, SHOP.y + Math.random() * SHOP.h, 'neon');
}
}
}
// RENDERING
function drawShopFloor(time, neonInside) {
ctx.save();
let floorColor = '#1f242e';
let wallColor = '#0b5239'; // Classic siren green
if (worldState === 'APOCALYPSE') {
const hue = (time * 120) % 360;
floorColor = `hsl(${hue}, 80%, 15%)`;
wallColor = `hsl(${(hue + 180) % 360}, 90%, 25%)`;
} else if (neonInside === 2) {
const pulse = Math.sin(time * 14) * 0.5 + 0.5;
floorColor = pulse > 0.5 ? '#2b1a32' : '#172827';
wallColor = pulse > 0.5 ? '#b81466' : '#0e6949';
} else if (neonInside === 1) {
const pulse = Math.sin(time * 3) * 0.5 + 0.5;
floorColor = `rgba(37, 36, 52, 1)`;
wallColor = `rgba(16, 95, 75, 1)`;
}
// Sidewalk outside
ctx.fillStyle = '#14181f';
ctx.fillRect(0, 0, SHOP.x, canvas.height);
ctx.strokeStyle = '#232b38';
ctx.lineWidth = 2;
for (let y = 0; y < canvas.height; y += 40) {
ctx.beginPath();
ctx.moveTo(0, y);
ctx.lineTo(SHOP.x, y);
ctx.stroke();
}
// Rebuild effect clipping
if (worldState === 'REBUILDING') {
ctx.beginPath();
const rh = SHOP.h * rebuildProgress;
ctx.rect(SHOP.x, SHOP.y + SHOP.h - rh, SHOP.w, rh);
ctx.clip();
}
// Shop interior floor
ctx.fillStyle = floorColor;
ctx.fillRect(SHOP.x, SHOP.y, SHOP.w, SHOP.h);
// Grid tile lines
ctx.strokeStyle = neonInside === 2 ? '#ff00aa33' : 'rgba(255,255,255,0.04)';
ctx.lineWidth = 1;
for (let x = SHOP.x; x < SHOP.x + SHOP.w; x += 36) {
ctx.beginPath();
ctx.moveTo(x, SHOP.y);
ctx.lineTo(x, SHOP.y + SHOP.h);
ctx.stroke();
}
for (let y = SHOP.y; y < SHOP.y + SHOP.h; y += 36) {
ctx.beginPath();
ctx.moveTo(SHOP.x, y);
ctx.lineTo(SHOP.x + SHOP.w, y);
ctx.stroke();
}
// Walls
ctx.fillStyle = wallColor;
ctx.fillRect(SHOP.x, SHOP.y, SHOP.w, 20); // Top wall
ctx.fillRect(SHOP.x + SHOP.w - 16, SHOP.y, 16, SHOP.h); // Right wall
ctx.fillRect(SHOP.x, SHOP.y + SHOP.h - 16, SHOP.w, 16); // Bottom wall
// Left wall with Door cutouts
ctx.fillRect(SHOP.x, SHOP.y, 14, SHOP.doorOut.y - SHOP.y - 25);
ctx.fillRect(SHOP.x, SHOP.doorOut.y + 25, 14, SHOP.doorIn.y - SHOP.doorOut.y - 50);
ctx.fillRect(SHOP.x, SHOP.doorIn.y + 25, 14, SHOP.y + SHOP.h - (SHOP.doorIn.y + 25));
// Doorway labels
ctx.fillStyle = '#64748b';
ctx.font = '10px sans-serif';
ctx.fillText('EXIT ↑', SHOP.x - 42, SHOP.doorOut.y + 3);
ctx.fillText('ENTER →', SHOP.x - 52, SHOP.doorIn.y + 3);
// Warm Bar Counter
ctx.fillStyle = '#8b5a2b';
ctx.fillRect(SHOP.counterOrder.x - 45, SHOP.counterOrder.y - 24, 210, 48);
ctx.fillStyle = '#4a2e12';
ctx.fillRect(SHOP.counterOrder.x - 42, SHOP.counterOrder.y - 21, 204, 8);
// Counter markings
ctx.fillStyle = '#e2e8f0';
ctx.font = 'bold 11px sans-serif';
ctx.fillText('ORDER', SHOP.counterOrder.x - 30, SHOP.counterOrder.y + 6);
ctx.fillText('PICKUP', SHOP.counterPickup.x - 24, SHOP.counterPickup.y + 6);
// Espresso Machine
ctx.fillStyle = '#94a3b8';
ctx.fillRect(SHOP.counterPickup.x - 50, SHOP.counterOrder.y - 20, 24, 20);
ctx.fillStyle = '#475569';
ctx.fillRect(SHOP.counterPickup.x - 46, SHOP.counterOrder.y - 12, 16, 12);
// Lounge tables
const tableSpots = [{x: 715, y: 150}, {x: 805, y: 150}, {x: 715, y: 230}, {x: 805, y: 230}, {x: 715, y: 390}, {x: 805, y: 390}];
tableSpots.forEach(t => {
ctx.beginPath();
ctx.arc(t.x, t.y, 18, 0, Math.PI * 2);
ctx.fillStyle = '#2c3340';
ctx.fill();
ctx.strokeStyle = '#3e4859';
ctx.lineWidth = 2;
ctx.stroke();
});
// Barista Dot
ctx.beginPath();
ctx.arc(barista.x, barista.y, 12, 0, Math.PI * 2);
ctx.fillStyle = '#10b981'; // Green apron
ctx.fill();
ctx.strokeStyle = '#ffffff';
ctx.lineWidth = 1.5;
ctx.stroke();
ctx.fillStyle = '#ffffff';
ctx.font = '9px sans-serif';
ctx.fillText('BARISTA', barista.x - 18, barista.y - 16);
ctx.restore();
}
// Draw dancing cosmic unicorn
function drawNeonUnicorn(centerX, centerY, time) {
ctx.save();
ctx.translate(centerX, centerY);
const dance = Math.sin(time * 8);
const bounceY = Math.abs(dance) * 16;
const tilt = Math.cos(time * 6) * 0.15;
ctx.translate(0, -bounceY);
ctx.rotate(tilt);
// Rainbow pulsating aura
const glowRadius = 90 + Math.sin(time * 12) * 25;
const grad = ctx.createRadialGradient(0, -10, 10, 0, -10, glowRadius);
grad.addColorStop(0, 'rgba(255, 0, 230, 0.8)');
grad.addColorStop(0.4, 'rgba(0, 240, 255, 0.6)');
grad.addColorStop(0.7, 'rgba(255, 235, 59, 0.4)');
grad.addColorStop(1, 'rgba(255, 0, 128, 0)');
ctx.fillStyle = grad;
ctx.beginPath();
ctx.arc(0, -10, glowRadius, 0, Math.PI * 2);
ctx.fill();
// Body
ctx.fillStyle = '#ffffff';
ctx.shadowColor = '#00f7ff';
ctx.shadowBlur = 25;
ctx.beginPath();
ctx.ellipse(0, 10, 48, 30, 0, 0, Math.PI * 2);
ctx.fill();
// Prancing legs
ctx.lineWidth = 8;
ctx.lineCap = 'round';
ctx.strokeStyle = '#ffffff';
for (let i = 0; i < 4; i++) {
const legX = -26 + i * 18;
const legAngle = Math.sin(time * 10 + i * 1.5) * 0.7;
ctx.save();
ctx.translate(legX, 32);
ctx.rotate(legAngle);
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(0, 32);
// Hooves
ctx.strokeStyle = i % 2 === 0 ? '#ff00aa' : '#00ffff';
ctx.stroke();
ctx.restore();
}
// Neck & Head
ctx.save();
ctx.translate(34, -14);
ctx.rotate(-0.35 + Math.sin(time * 9) * 0.12);
// Neck
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.ellipse(0, 0, 16, 26, -0.4, 0, Math.PI * 2);
ctx.fill();
// Head
ctx.translate(14, -20);
ctx.beginPath();
ctx.ellipse(0, 0, 24, 15, -0.2, 0, Math.PI * 2);
ctx.fill();
// Cute eye
ctx.fillStyle = '#ff00aa';
ctx.beginPath();
ctx.arc(4, -3, 4, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.arc(5, -4, 1.5, 0, Math.PI * 2);
ctx.fill();
// Rainbow Horn
ctx.save();
ctx.translate(10, -14);
ctx.rotate(0.5 + Math.sin(time * 15) * 0.1);
ctx.beginPath();
ctx.moveTo(-6, 0);
ctx.lineTo(6, 0);
ctx.lineTo(0, -60);
ctx.closePath();
const hornGrad = ctx.createLinearGradient(0, 0, 0, -60);
hornGrad.addColorStop(0, '#ff00e6');
hornGrad.addColorStop(0.33, '#00f7ff');
hornGrad.addColorStop(0.66, '#ffff00');
hornGrad.addColorStop(1, '#ffffff');
ctx.fillStyle = hornGrad;
ctx.shadowColor = '#ffffff';
ctx.shadowBlur = 30;
ctx.fill();
ctx.restore();
ctx.restore(); // Head
// Mane of pure rainbow curves
ctx.lineWidth = 5;
for (let j = 0; j < 5; j++) {
ctx.strokeStyle = `hsl(${(time * 200 + j * 50) % 360}, 100%, 65%)`;
ctx.beginPath();
ctx.moveTo(10, -10 + j * 7);
ctx.bezierCurveTo(-15, -20 + j * 10 + Math.sin(time * 12 + j) * 15,
-35, -5 + j * 10,
-45, 10 + j * 12);
ctx.stroke();
}
// Dynamic Tail
for (let k = 0; k < 4; k++) {
ctx.strokeStyle = `hsl(${(time * 250 + k * 60) % 360}, 100%, 60%)`;
ctx.beginPath();
ctx.moveTo(-45, 10);
ctx.bezierCurveTo(-70, 0 + Math.sin(time * 10 + k) * 20,
-85, 30 + Math.cos(time * 8 + k) * 20,
-105, 20 + k * 8);
ctx.stroke();
}
ctx.restore();
}
function drawCustomers(time) {
customers.forEach(c => {
ctx.save();
ctx.translate(c.x, c.y);
// Customer body
ctx.beginPath();
ctx.arc(0, 0, c.radius, 0, Math.PI * 2);
ctx.fillStyle = c.color;
ctx.fill();
ctx.strokeStyle = '#ffffff';
ctx.lineWidth = 2;
ctx.stroke();
// Drink in hand
if (c.hasDrink) {
ctx.save();
ctx.translate(11, -7);
if (c.isNeon) {
// NEON UNICORN FRAPPUCCINO
const rainbowHue = (time * 300 + c.id * 50) % 360;
ctx.shadowColor = `hsl(${rainbowHue}, 100%, 60%)`;
ctx.shadowBlur = 15;
// Cup Body
ctx.fillStyle = `hsl(${rainbowHue}, 90%, 65%)`;
ctx.beginPath();
ctx.moveTo(-4, -6);
ctx.lineTo(4, -6);
ctx.lineTo(3, 6);
ctx.lineTo(-3, 6);
ctx.closePath();
ctx.fill();
// Dome lid
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.arc(0, -6, 4, Math.PI, 0);
ctx.fill();
// Radiant straw
ctx.strokeStyle = '#00f7ff';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(1, -10);
ctx.lineTo(3, -15);
ctx.stroke();
// Little spinning sparkles around cup
const spAngle = time * 7;
ctx.fillStyle = '#ffffff';
ctx.fillRect(Math.cos(spAngle) * 9, Math.sin(spAngle) * 9, 2, 2);
ctx.fillRect(Math.cos(spAngle + Math.PI) * 9, Math.sin(spAngle + Math.PI) * 9, 2, 2);
} else {
// Standard corporate frappuccino
ctx.fillStyle = '#d2b48c'; // Tan frappe
ctx.beginPath();
ctx.moveTo(-4, -6);
ctx.lineTo(4, -6);
ctx.lineTo(3, 6);
ctx.lineTo(-3, 6);
ctx.closePath();
ctx.fill();
// Dome lid
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.arc(0, -6, 4, Math.PI, 0);
ctx.fill();
// Green straw
ctx.strokeStyle = '#10b981';
ctx.lineWidth = 1.5;
ctx.beginPath();
ctx.moveTo(1, -10);
ctx.lineTo(2, -14);
ctx.stroke();
}
ctx.restore();
}
ctx.restore();
});
}
function drawEffects(time) {
// Draw Particles
particles.forEach(p => {
ctx.save();
const alpha = Math.max(0, p.life / p.maxLife);
ctx.globalAlpha = alpha;
ctx.fillStyle = p.color;
ctx.shadowColor = p.color;
ctx.shadowBlur = 8;
ctx.beginPath();
ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
});
// Draw Floating Texts
floatingTexts.forEach(ft => {
ctx.save();
const alpha = Math.max(0, ft.life / ft.maxLife);
ctx.globalAlpha = alpha;
ctx.fillStyle = ft.color;
ctx.shadowColor = ft.color;
ctx.shadowBlur = 10;
ctx.font = 'bold 13px sans-serif';
ctx.fillText(ft.text, ft.x, ft.y);
ctx.restore();
});
// Apocalypse Overlay / Giant Unicorn
if (worldState === 'APOCALYPSE') {
// Swirling dimension rays
ctx.save();
ctx.translate(SHOP.x + SHOP.w / 2, SHOP.y + SHOP.h / 2);
ctx.rotate(time * 0.8);
for (let i = 0; i < 12; i++) {
ctx.beginPath();
ctx.moveTo(0, 0);
const a1 = (i * Math.PI * 2) / 12;
const a2 = a1 + 0.22;
ctx.arc(0, 0, 700, a1, a2);
ctx.closePath();
ctx.fillStyle = i % 2 === 0 ? 'rgba(255, 0, 180, 0.12)' : 'rgba(0, 240, 255, 0.12)';
ctx.fill();
}
ctx.restore();
// Big Dancing Unicorn in center
drawNeonUnicorn(SHOP.x + SHOP.w / 2, SHOP.y + SHOP.h / 2, time);
// Apocalypse Banner
ctx.save();
ctx.textAlign = 'center';
ctx.font = '900 36px sans-serif';
ctx.fillStyle = '#ffffff';
ctx.shadowColor = '#ff00aa';
ctx.shadowBlur = 24;
ctx.fillText('NEON UNICORN CATASTROPHE', SHOP.x + SHOP.w / 2, SHOP.y + 70);
ctx.font = 'bold 15px sans-serif';
ctx.fillStyle = '#00f7ff';
ctx.fillText('CRITICAL COINCIDENCE: 3+ MYTHICAL BEVERAGES COLLAPSED REALITY', SHOP.x + SHOP.w / 2, SHOP.y + 95);
ctx.restore();
}
// Rebuild Overlay Banner
if (worldState === 'REBUILDING') {
ctx.save();
ctx.fillStyle = 'rgba(15, 17, 21, 0.65)';
ctx.fillRect(SHOP.x, SHOP.y, SHOP.w, SHOP.h);
ctx.textAlign = 'center';
ctx.fillStyle = '#34d399';
ctx.font = 'bold 22px sans-serif';
ctx.fillText('RECONSTRUCTING COFFEE SANCTUARY...', SHOP.x + SHOP.w / 2, SHOP.y + SHOP.h / 2 - 15);
// Progress Bar
ctx.fillStyle = '#1e293b';
ctx.fillRect(SHOP.x + SHOP.w / 2 - 150, SHOP.y + SHOP.h / 2 + 10, 300, 16);
ctx.fillStyle = '#10b981';
ctx.fillRect(SHOP.x + SHOP.w / 2 - 148, SHOP.y + SHOP.h / 2 + 12, 296 * rebuildProgress, 12);
ctx.restore();
}
}
function updateThreatUI(neonInside) {
if (worldState === 'APOCALYPSE') {
elThreat.className = 'threat-badge threat-3';
elThreat.textContent = 'DIMENSIONAL BREACH (ACTIVE)';
} else if (neonInside === 2) {
elThreat.className = 'threat-badge threat-2';
elThreat.textContent = 'UNICORNS INSIDE: 2 / 3 (CRITICAL INSTABILITY)';
} else if (neonInside === 1) {
elThreat.className = 'threat-badge threat-1';
elThreat.textContent = 'UNICORNS INSIDE: 1 / 3 (ANOMALOUS VIBES)';
} else {
elThreat.className = 'threat-badge threat-0';
elThreat.textContent = 'UNICORNS INSIDE: 0 / 3 (STABLE)';
}
}
function updateStatsUI(neonInside) {
elServed.textContent = totalServed;
elQueued.textContent = customers.filter(c => !c.inside && c.state !== 'GONE').length;
elNeons.textContent = totalNeons;
elNeonsInside.textContent = neonInside;
const rate = totalServed > 0 ? ((totalNeons / totalServed) * 100).toFixed(1) + '%' : '0.0%';
elRate.textContent = rate;
elCatastrophes.textContent = totalCatastrophes;
elRebuilds.textContent = totalCatastrophes;
elStreak.textContent = currentStreak;
elMaxStreak.textContent = maxStreak;
if (streaks.length > 0) {
const avg = (streaks.reduce((a, b) => a + b, 0) / streaks.length).toFixed(1);
elAvgLife.textContent = `${avg} cust`;
} else {
elAvgLife.textContent = '—';
}
}
// MAIN LOOP
let lastTimestamp = performance.now();
function frame(timestamp) {
const rawDt = Math.min((timestamp - lastTimestamp) / 1000, 0.1);
lastTimestamp = timestamp;
const dt = rawDt * simSpeed;
const time = timestamp / 1000;
if (dt > 0) {
// Substep high speeds to maintain collision & trigger fidelity
if (simSpeed > 2) {
const steps = Math.ceil(simSpeed);
const subDt = dt / steps;
for (let s = 0; s < steps; s++) {
update(subDt);
}
} else {
update(dt);
}
}
const neonInside = getActiveNeonCount();
updateThreatUI(neonInside);
updateStatsUI(neonInside);
// Render Canvas
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.save();
if (shakeX !== 0 || shakeY !== 0) {
ctx.translate(shakeX, shakeY);
}
drawShopFloor(time, neonInside);
drawCustomers(time);
drawEffects(time);
ctx.restore();
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
})();
</script>
</body>
</html>
When first launched, the simulation opens onto a tranquil Starbucks-style store floor. Customers enter from the sidewalk queue on the left (adhering strictly to the 8-customer interior limit), line up at the order register, wait for the barista to pull a cup, and proceed to the tables to drink.
For each drink, the barista rolls a pure Math.random() < 1/6 die right at the pickup bar. For the first minute or so, you will observe ordinary brown frappuccinos mixed with occasional glowing pastel Neon Unicorns.
CRITICAL INSTABILITY. Customers linger for around 3 to 4.5 seconds, so 2 unicorns will frequently cross paths and narrowly clear out without incident.APOCALYPSE: the store walls blow outward, gravity fails, the customers are whipped into orbital trajectories, and a giant dancing procedural unicorn materializes in the center with a rotating celestial aura, waving tail, and a rainbow horn firing particle beams. After ~6.5 seconds, the store automatically reconstructs via a floor-raise animation, sweeps clean, and restarts.Tuning & Special Cases:
neonInside >= 3.What it does badly: Because catastrophe depends entirely on stochastic clustering, the variance can be extreme. If left running, you will occasionally see two catastrophes occur back-to-back within 15 customers (a streak of 12 feels ridiculously unfair), followed by a massive drought where 300+ customers pass through without three ever colliding in the room. Furthermore, if you let it run at 15× speed for an hour, the customer ID counter climbs into the tens of thousands; while object arrays are pruned cleanly to avoid memory leaks, the sheer number of cataclysms will make the "Average Store Lifespan" metric reveal just how fragile corporate coffee reality truly is.