add exploration replay
This commit is contained in:
parent
dcdf37d87f
commit
d37d3ea2ff
1 changed files with 73 additions and 0 deletions
73
exploration.html
Normal file
73
exploration.html
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Static Pulse Gardens — exploration</title>
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body { background: #0a0a0f; color: #3a3a4a; font-family: ui-monospace, monospace; overflow: hidden; }
|
||||||
|
#grid { padding: 20px; font-size: 12px; line-height: 1.4; white-space: pre; }
|
||||||
|
.c { display: inline-block; transition: all 0.3s; }
|
||||||
|
.c.active { color: #fde68a; text-shadow: 0 0 6px rgba(253,230,138,0.5); }
|
||||||
|
.c.strong { color: #34d399; text-shadow: 0 0 10px rgba(52,211,153,0.6); font-weight: bold; }
|
||||||
|
.c.dead { color: #1a1a2a; }
|
||||||
|
#info { position: fixed; bottom: 10px; left: 20px; color: #3a3a4a; font-size: 11px; }
|
||||||
|
#controls { position: fixed; top: 10px; right: 20px; color: #666; font-size: 11px; }
|
||||||
|
#controls span { cursor: pointer; margin-left: 12px; color: #fde68a; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="grid"></div>
|
||||||
|
<div id="info">neurameba · physarum exploration</div>
|
||||||
|
<div id="controls"><span id="play-btn">play</span><span id="reset-btn">reset</span></div>
|
||||||
|
<script>
|
||||||
|
const text = "# Quick Start\n\n## Join\n\n```\n/register\n```\n\n## Post\n\nJust type. No `/` needed.\n\n```\nhello motd [introductions]\n```\n\nTags go in [brackets]. New tags are created automatically.\n\nUse `/post` to skip the confirm prompt.\n\n## Browse\n\n```\n/feed\n```\n\n## Find\n\n```\n/find rust\n/find @alice\n```\n\n## Reply\n\n```\n/reply abc123 nice work\n/re same but replies to last post you saw\n```\n\n## Profile\n\n```\n/avatar upload a profile pic\n/settings change name, bio\n/profile view yours\n/profile @alice view theirs\n```\n\n## Media\n\n```\n/upload pick a file (PNG, MP3, MP4)\n/post check this out /attach m3kf9x attach to post\n```\n\n## Hide noise\n\n```\n/kill @spammer\n/kill abc123\n```\n\nNobody knows. It just disappears.\n\n## More\n\n```\n/help all commands\n/read about what motd is\n/read commands full reference\n/tree -cat browse tags\n```\n";
|
||||||
|
const passes = [{"t":0,"r":46,"c":0,"a":"hold","s":0.24827441541160267,"ps":9,"e":100.63619532329282,"pr":1.1},{"t":0,"r":42,"c":0,"a":"extend","s":0.3189884019400614,"ps":9,"e":70.84133505086434,"pr":1.1},{"t":0,"r":53,"c":48,"a":"hold","s":0.2621486134884677,"ps":9,"e":100.74718890790774,"pr":1.1},{"t":0,"r":4,"c":2,"a":"extend","s":0.38459165584041727,"ps":9,"e":71.20871327270633,"pr":1.1},{"t":0,"r":23,"c":3,"a":"extend","s":0.36261974716671697,"ps":9,"e":71.08567058413361,"pr":1.1},{"t":1,"r":46,"c":0,"a":"hold","s":0.24089855609051722,"ps":10,"e":101.06338377201696,"pr":1.2000000000000002},{"t":1,"r":42,"c":0,"a":"hold","s":0.3130289238285809,"ps":8,"e":72.14556644149299,"pr":1.05},{"t":1,"r":53,"c":48,"a":"hold","s":0.29072990926585257,"ps":9,"e":101.72302818203457,"pr":1.1},{"t":1,"r":4,"c":2,"a":"extend","s":0.3651548281551106,"ps":8,"e":51.05096632856305,"pr":1.05},{"t":1,"r":23,"c":3,"a":"hold","s":0.3065557128275978,"ps":9,"e":72.1881162867544,"pr":1.1},{"t":1,"r":43,"c":0,"a":"hold","s":0.20057085510688702,"ps":5,"e":31.215139005511244,"pr":1.2000000000000002},{"t":1,"r":4,"c":1,"a":"hold","s":0.2198006737669935,"ps":5,"e":31.52642536415295,"pr":1.2000000000000002},{"t":1,"r":23,"c":4,"a":"hold","s":0.2512680899277884,"ps":5,"e":31.72543211262243,"pr":1.2000000000000002},{"t":2,"r":46,"c":0,"a":"retracted","s":0.2464654314931913,"ps":10,"e":101.5351072239625,"pr":1.2000000000000002},{"t":2,"r":42,"c":0,"a":"hold","s":0.3189884019400614,"ps":7,"e":73.64747365701348,"pr":1},{"t":2,"r":53,"c":48,"a":"retracted","s":0.29072990926585257,"ps":8,"e":102.84886745616139,"pr":1.05},{"t":2,"r":4,"c":2,"a":"extend","s":0.38459165584041727,"ps":7,"e":37.15438970270047,"pr":1},{"t":2,"r":23,"c":3,"a":"hold","s":0.3065557128275978,"ps":8,"e":73.44056198937517,"pr":1.05},{"t":2,"r":43,"c":0,"a":"hold","s":0.3542465769802951,"ps":5,"e":33.2991116213536,"pr":1.2000000000000002},{"t":2,"r":4,"c":1,"a":"hold","s":0.34295133379953846,"ps":5,"e":33.52003603454926,"pr":1.2000000000000002},{"t":2,"r":23,"c":4,"a":"hold","s":0.2802465657430612,"ps":5,"e":33.21740463856692,"pr":1.2000000000000002},{"t":2,"r":5,"c":2,"a":"hold","s":0.09853128207426315,"ps":5,"e":21.91723582597827,"pr":1.1500000000000001},{"t":3,"r":42,"c":0,"a":"retracted","s":0.11832396075023144,"ps":8,"e":73.39406534301533,"pr":1.1},{"t":3,"r":4,"c":2,"a":"extend","s":0.39307240543106897,"ps":6,"e":27.579278262304317,"pr":0.95},{"t":3,"r":23,"c":3,"a":"retracted","s":0.36261974716671697,"ps":8,"e":75.1415199667089,"pr":1.05},{"t":3,"r":43,"c":0,"a":"retracted","s":0.3542465769802951,"ps":4,"e":35.533084237195965,"pr":1.1500000000000001},{"t":3,"r":4,"c":1,"a":"retracted","s":0.34295133379953846,"ps":4,"e":35.66364670494556,"pr":1.1500000000000001},{"t":3,"r":23,"c":4,"a":"retracted","s":0.2802465657430612,"ps":4,"e":34.85937716451141,"pr":1.1500000000000001},{"t":3,"r":5,"c":2,"a":"hold","s":0.13485423509901692,"ps":5,"e":22.246069706770406,"pr":1.1500000000000001},{"t":4,"r":4,"c":2,"a":"hold","s":0.37452762076086693,"ps":5,"e":29.82549922839125,"pr":0.8999999999999999},{"t":4,"r":5,"c":2,"a":"retracted","s":0.13356985818870806,"ps":4,"e":22.71462857228007,"pr":1.1},{"t":5,"r":4,"c":2,"a":"hold","s":0.27062772737266527,"ps":6,"e":31.090521047372572,"pr":0.9999999999999999},{"t":6,"r":4,"c":2,"a":"retracted","s":0.2656698726751147,"ps":5,"e":32.46588002877349,"pr":0.9499999999999998}];
|
||||||
|
const lines = text.split('\n');
|
||||||
|
const gridEl = document.getElementById('grid');
|
||||||
|
const charEls = [];
|
||||||
|
for (let r = 0; r < lines.length; r++) {
|
||||||
|
const row = [];
|
||||||
|
for (let c = 0; c < lines[r].length; c++) {
|
||||||
|
const s = document.createElement('span');
|
||||||
|
s.className = 'c';
|
||||||
|
s.textContent = lines[r][c];
|
||||||
|
row.push(s);
|
||||||
|
gridEl.appendChild(s);
|
||||||
|
}
|
||||||
|
charEls.push(row);
|
||||||
|
gridEl.appendChild(document.createTextNode('\n'));
|
||||||
|
}
|
||||||
|
let tick = -1, playing = false, iv;
|
||||||
|
function apply(t) {
|
||||||
|
for (const r of charEls) for (const e of r) e.className = 'c';
|
||||||
|
const active = new Map();
|
||||||
|
for (const p of passes) {
|
||||||
|
if (p.t > t) break;
|
||||||
|
const k = p.r+','+p.c;
|
||||||
|
if (p.a === 'died' || p.a === 'retracted') active.set(k, 'dead');
|
||||||
|
else if (p.ps > 16) active.set(k, 'strong');
|
||||||
|
else active.set(k, 'active');
|
||||||
|
}
|
||||||
|
for (const [k, cls] of active) {
|
||||||
|
const [r, c] = k.split(',').map(Number);
|
||||||
|
if (charEls[r]?.[c]) charEls[r][c].className = 'c ' + cls;
|
||||||
|
}
|
||||||
|
document.getElementById('info').textContent = 'tick ' + t + ' · ' + [...active.values()].filter(v=>v!=='dead').length + ' alive';
|
||||||
|
}
|
||||||
|
function play() {
|
||||||
|
if (playing) return;
|
||||||
|
playing = true;
|
||||||
|
document.getElementById('play-btn').textContent = 'pause';
|
||||||
|
const max = passes.length > 0 ? passes[passes.length-1].t : 0;
|
||||||
|
iv = setInterval(() => { tick++; if (tick > max) { pause(); return; } apply(tick); }, 900);
|
||||||
|
}
|
||||||
|
function pause() { playing = false; clearInterval(iv); document.getElementById('play-btn').textContent = 'play'; }
|
||||||
|
function reset() { pause(); tick = -1; for (const r of charEls) for (const e of r) e.className = 'c'; document.getElementById('info').textContent = 'neurameba'; }
|
||||||
|
document.getElementById('play-btn').addEventListener('click', () => playing ? pause() : play());
|
||||||
|
document.getElementById('reset-btn').addEventListener('click', reset);
|
||||||
|
setTimeout(play, 1000);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue