Geoo/THX-01-bucket / doom /index.html
Geoo's picture
download
raw
8.28 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>THX-01 plays Doom</title>
<style>
:root {
--bg: #0e0e0d; --panel: #171716; --line: #2a2a28; --ink: #f4f3ee; --ink2: #b7b5ab; --muted: #7d7b73;
--accent: #3987e5; --hot: #e66767; --good: #199e70; --bar: #2b2b29;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: baseline; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
header .sub { color: var(--ink2); font-size: 13px; }
header .sp { flex: 1; }
.scen button { background: var(--panel); color: var(--ink2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; margin-left: 6px; cursor: pointer; font: inherit; font-size: 12px; }
.scen button.on { color: var(--ink); border-color: var(--accent); }
main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: 16px; padding: 16px 20px; }
@media (max-width: 980px) { main { grid-template-columns: 1fr; } }
.game { background: #000; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; }
.game img { width: 100%; display: block; image-rendering: pixelated; aspect-ratio: 4/3; }
.tag { position: absolute; left: 12px; top: 10px; background: rgba(0,0,0,.6); padding: 3px 8px; border-radius: 5px; font-size: 12px; color: var(--ink2); }
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.card h2 { font-size: 12px; margin: 0 0 10px; color: var(--ink2); text-transform: uppercase; letter-spacing: .7px; font-weight: 600; }
.act { display: grid; grid-template-columns: 128px 1fr 48px; align-items: center; gap: 8px; margin: 5px 0; font-variant-numeric: tabular-nums; }
.act .n { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--ink2); }
.act.on .n { color: var(--ink); font-weight: 700; }
.track { height: 10px; background: var(--bar); border-radius: 5px; overflow: hidden; }
.fill { height: 100%; background: var(--muted); border-radius: 5px; transition: width .08s linear; }
.act.on .fill { background: var(--accent); }
.act .p { text-align: right; font-size: 12px; color: var(--ink2); }
.threat { display: flex; align-items: center; gap: 12px; }
.threat .track { flex: 1; height: 14px; border-radius: 7px; }
.threat .fill { background: var(--hot); border-radius: 7px; }
.threat .v { width: 70px; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.yes { color: var(--hot); } .no { color: var(--muted); }
pre { margin: 0; white-space: pre-wrap; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #d6d4ca; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12px; }
td, th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 500; }
.mini { display: grid; grid-template-columns: 128px 1fr 48px; gap: 8px; align-items: center; margin: 3px 0; font-size: 12px; }
.mini .fill { background: var(--good); }
footer { color: var(--muted); font-size: 12px; padding: 0 20px 18px; }
</style>
</head>
<body>
<header>
<h1>THX-01 plays Doom</h1>
<span class="sub">no vision · no text generation · two typed questions answered in one forward pass per step</span>
<span class="sp"></span>
<span class="scen" id="scen"></span>
</header>
<main>
<section>
<div class="game"><img src="/stream.mjpg" alt="Live Doom game played by THX-01"><span class="tag" id="scenTag">—</span></div>
<div class="row">
<div class="stat"><div class="k">Key pressed</div><div class="v" id="key" style="font-size:16px">–</div></div>
<div class="stat"><div class="k">Latency / decision</div><div class="v" id="lat">–</div></div>
<div class="stat"><div class="k">Decisions / s</div><div class="v" id="dps">–</div></div>
<div class="stat"><div class="k">Health</div><div class="v" id="hp">–</div></div>
<div class="stat"><div class="k">Kills</div><div class="v" id="kills">–</div></div>
</div>
<div class="card" style="margin-top:12px">
<h2>State · the only thing the model reads</h2>
<pre id="state">waiting for the first decision…</pre>
</div>
</section>
<aside>
<div class="card">
<h2>Choice · next action</h2>
<div id="acts"></div>
</div>
<div class="card">
<h2>Noul · enemy in crosshair?</h2>
<div class="threat"><div class="track"><div class="fill" id="thr" style="width:0"></div></div><div class="v" id="thrv">–</div></div>
</div>
<div class="card">
<h2>All decisions so far · <span id="ndec">0</span></h2>
<div id="dist"></div>
</div>
<div class="card">
<h2>Episodes</h2>
<table><thead><tr><th>#</th><th>scenario</th><th>kills</th><th>steps</th><th>result</th></tr></thead><tbody id="eps"></tbody></table>
</div>
</aside>
</main>
<footer>Key pressed = ATTACK when P(crosshair on enemy) ≥ 0.5, otherwise the top choice · THX-01 · RTX 4090 · output tokens: 0 · no Doom data in training — the model reads the state text, the rules and the option names.</footer>
<script>
const ORDER = ["ATTACK","TURN_LEFT","TURN_RIGHT","MOVE_FORWARD","MOVE_LEFT","MOVE_RIGHT","MOVE_BACKWARD"];
const SCEN = ["defend_the_center","deadly_corridor","defend_the_line","basic"];
const $ = id => document.getElementById(id);
function bars(el, probs, chosen, cls) {
const keys = ORDER.filter(k => k in probs);
el.innerHTML = keys.map(k => `<div class="${cls}${k===chosen?' on':''}"><span class="n">${k}</span><div class="track"><div class="fill" style="width:${(100*probs[k]).toFixed(1)}%"></div></div><span class="p">${(100*probs[k]).toFixed(0)}%</span></div>`).join("");
}
function episodes(list) {
$("eps").innerHTML = list.slice().reverse().map((e, i) => `<tr><td>${list.length - i}</td><td>${e.scenario}</td><td>${e.kills}</td><td>${e.steps}</td><td>${e.survived ? '<span style="color:var(--good)">survived</span>' : '<span class="yes">died</span>'}</td></tr>`).join("");
}
let current = null;
function scenButtons() {
$("scen").innerHTML = SCEN.map(s => `<button class="${s===current?'on':''}" onclick="pick('${s}')">${s}</button>`).join("");
}
function pick(s) { fetch("/scenario/" + s, {method: "POST"}); }
const es = new EventSource("/events");
es.onmessage = m => {
const e = JSON.parse(m.data);
if (e.type === "episode") { episodes(e.episodes); return; }
if (e.scenario !== current) { current = e.scenario; scenButtons(); $("scenTag").textContent = current; }
$("lat").textContent = e.latency_ms.toFixed(1) + " ms";
$("key").textContent = e.action + (e.action === "ATTACK" && e.threat >= .5 ? " · noul fire" : "");
$("dps").textContent = e.dps.toFixed(0);
$("hp").textContent = Math.round(e.hp);
$("kills").textContent = Math.round(e.kills);
$("state").textContent = e.state;
const top = Object.keys(e.probs).reduce((a, b) => e.probs[a] >= e.probs[b] ? a : b);
bars($("acts"), e.probs, top, "act");
$("thr").style.width = (100 * e.threat).toFixed(1) + "%";
$("thrv").innerHTML = `<span class="${e.threat >= .5 ? 'yes' : 'no'}">${e.threat >= .5 ? 'YES' : 'no'}</span> ${(100*e.threat).toFixed(0)}%`;
const tot = Object.values(e.total_actions).reduce((a, b) => a + b, 0);
const frac = Object.fromEntries(Object.entries(e.total_actions).map(([k, v]) => [k, v / tot]));
bars($("dist"), frac, null, "mini");
$("ndec").textContent = e.decisions;
episodes(e.episodes);
};
scenButtons();
</script>
</body>
</html>

Xet Storage Details

Size:
8.28 kB
·
Xet hash:
2084a39f9332f0d9e87c0aa95551eb06c9e50a66b1480af4cef319ac921dd5e3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.