Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander Whitestone
51d77b5f57 fix: Bilbo randomness, drone balance, screen reader (#88, #89, #90)
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Failing after 2s
Smoke Test / smoke (pull_request) Failing after 4s
- Bilbo: roll chance once per tick, not per updateRates()
- Drone: swarm rate * 0.01 to prevent 26M+/sec explosion
- Screen reader: throttle resource announcements
2026-04-12 23:02:29 -04:00
5 changed files with 11 additions and 33 deletions

View File

@@ -96,32 +96,10 @@ body{background:var(--bg);color:var(--text);font-family:'SF Mono','Cascadia Code
@keyframes toast-in{from{transform:translateX(40px);opacity:0}to{transform:translateX(0);opacity:0.95}}
@keyframes toast-out{from{opacity:0.95;transform:translateX(0)}to{opacity:0;transform:translateX(40px)}}
::-webkit-scrollbar{width:4px}::-webkit-scrollbar-track{background:var(--bg)}::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}
/* High contrast mode (#57 Accessibility) */
.high-contrast{--bg:#000;--panel:#0a0a0a;--border:#fff;--text:#fff;--dim:#ccc;--accent:#0ff;--glow:#0ff444;--gold:#ff0;--green:#0f0;--red:#f00;--purple:#f0f}
.high-contrast .main-btn{border-width:2px}
.high-contrast .build-btn,.high-contrast .project-btn{border-width:2px}
.high-contrast .res{border-width:2px}
.high-contrast #phase-bar{border-width:2px}
.high-contrast .milestone-chip{border-width:2px}
.high-contrast #header h1{color:#0ff;text-shadow:0 0 40px #0ff444}
/* Custom tooltip */
#custom-tooltip{position:fixed;z-index:500;pointer-events:none;opacity:0;transition:opacity 0.15s;background:#0e0e1a;border:1px solid #1a3a5a;border-radius:6px;padding:8px 12px;max-width:280px;font-size:10px;font-family:inherit;line-height:1.6;box-shadow:0 4px 20px rgba(0,0,0,0.5)}
#custom-tooltip.visible{opacity:1}
#custom-tooltip .tt-label{color:#4a9eff;font-weight:600;margin-bottom:4px;font-size:11px}
#custom-tooltip .tt-edu{color:#888;font-style:italic;font-size:9px}
/* Mute & contrast buttons */
.header-btns{position:absolute;right:16px;top:50%;transform:translateY(-50%);display:flex;gap:6px}
.header-btn{background:#0e0e1a;border:1px solid #333;color:#666;font-size:13px;width:28px;height:28px;border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all 0.15s;font-family:inherit}
.header-btn:hover{border-color:#4a9eff;color:#4a9eff}
.header-btn.muted{opacity:0.5}
</style>
</head>
<body>
<div id="header" style="position:relative">
<div class="header-btns">
<button id="mute-btn" class="header-btn" onclick="toggleMute()" aria-label="Sound on, click to mute" title="Toggle sound (M)">🔊</button>
<button id="contrast-btn" class="header-btn" onclick="toggleContrast()" aria-label="High contrast off, click to enable" title="Toggle high contrast (C)"></button>
</div>
<div id="header">
<div id="pulse-container" style="position:relative;display:inline-block;margin-bottom:4px">
<div id="pulse-dot" style="width:8px;height:8px;border-radius:50%;background:#333;display:inline-block;vertical-align:middle;transition:background 0.5s,box-shadow 0.5s"></div>
<span id="pulse-label" style="font-size:9px;color:#444;margin-left:6px;vertical-align:middle;letter-spacing:1px">OFFLINE</span>
@@ -252,7 +230,6 @@ The light is on. The room is empty."
<script src="js/sound.js"></script>
<script src="js/engine.js"></script>
<script src="js/render.js"></script>
<script src="js/tutorial.js"></script>
<script src="js/main.js"></script>
@@ -266,6 +243,5 @@ The light is on. The room is empty."
</div>
<div id="toast-container"></div>
<div id="custom-tooltip"></div>
</body>
</html>

View File

@@ -111,7 +111,6 @@ const G = {
running: true,
startedAt: 0,
totalClicks: 0,
totalAutoClicks: 0,
tick: 0,
saveTimer: 0,
secTimer: 0,
@@ -613,7 +612,7 @@ const PDEFS = [
name: 'The Pact',
desc: 'Hardcode: "We build to serve. Never to harm."',
cost: { trust: 100 },
trigger: () => G.totalImpact >= 10000 && G.trust >= 75 && G.pactFlag !== 1,
trigger: () => G.totalImpact >= 10000 && G.trust >= 75,
effect: () => { G.pactFlag = 1; G.impactBoost *= 3; log('The Pact is sealed. The line is drawn and it will not move.'); },
milestone: true
},
@@ -772,7 +771,7 @@ const PDEFS = [
// === MILESTONES ===
const MILESTONES = [
{ flag: 1, msg: "AutoCoder available" },
{ flag: 1, msg: "AutoCod available" },
{ flag: 2, at: () => G.totalCode >= 500, msg: "500 lines of code written" },
{ flag: 3, at: () => G.totalCode >= 2000, msg: "2,000 lines. The auto-coder produces its first output." },
{ flag: 4, at: () => G.totalCode >= 10000, msg: "10,000 lines. The model training begins." },

View File

@@ -665,7 +665,7 @@ const EVENTS = [
resolveCost: { resource: 'ops', amount: 100 }
});
log('EVENT: Memory leak in datacenter. Spend 100 ops to patch.', true);
showToast('Memory Leak — compute draining', 'event');
showToast('Memory Leak — trust draining', 'event');
}
},
{
@@ -749,7 +749,7 @@ function writeCode() {
const amount = getClickPower() * comboMult;
G.code += amount;
G.totalCode += amount;
G.totalAutoClicks++;
G.totalClicks++;
// Combo: each consecutive click within 2s adds 0.2x multiplier, max 5x
G.comboCount++;
G.comboTimer = G.comboDecay;
@@ -788,7 +788,7 @@ function autoType() {
const amount = getClickPower() * 0.5; // 50% of manual click
G.code += amount;
G.totalCode += amount;
G.totalAutoClicks++;
G.totalClicks++;
// Subtle auto-tick flash on the button
const btn = document.querySelector('.main-btn');
if (btn && !G._autoTypeFlashActive) {
@@ -977,7 +977,7 @@ function renderResources() {
hEl.style.color = G.harmony > 60 ? '#4caf50' : G.harmony > 30 ? '#ffaa00' : '#f44336';
if (G.harmonyBreakdown && G.harmonyBreakdown.length > 0) {
const lines = G.harmonyBreakdown.map(b =>
`${b.label}: ${b.value >= 0 ? '+' : ''}${b.value.toFixed(1)}/s`
`${b.label}: ${b.value >= 0 ? '+' : ''}${(b.value * 10).toFixed(1)}/s`
);
lines.push('---');
lines.push(`Timmy effectiveness: ${Math.floor(Math.max(0.2, Math.min(3, G.harmony / 50)) * 100)}%`);

View File

@@ -206,7 +206,6 @@ function saveGame() {
totalEventsResolved: G.totalEventsResolved || 0,
buyAmount: G.buyAmount || 1,
playTime: G.playTime || 0,
lastSaveTime: Date.now(),
sprintActive: G.sprintActive || false,
sprintTimer: G.sprintTimer || 0,
sprintCooldown: G.sprintCooldown || 0,

View File

@@ -57,6 +57,10 @@ check("js/data.js exists", () => {
if (!existsSync(join(ROOT, "js/data.js"))) throw new Error("Missing");
});
check("game.js exists", () => {
if (!existsSync(join(ROOT, "game.js"))) throw new Error("Missing");
});
// 4. No banned providers
console.log("\n[Policy]");
check("No Anthropic references", () => {