Boolean Gradient Gantt: languages braided, Boolean-gated, crypto glass sharding, full user controls
3a558a7 verified Download bgg.html from SANDDIDIT/ghost: direct link, hf CLI and curl.
- Browser
- Download file 13 kB
-
https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/bgg.html
- Command line
-
hf download hf://spaces/SANDDIDIT/ghost/bgg.html
-
curl -L -o bgg.html https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/bgg.html
13 kB
| <html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"> | |
| <title>Boolean Gradient Gantt · SAND</title> | |
| <style> | |
| *{box-sizing:border-box} | |
| html,body{margin:0;height:100%;background:#03050a;color:#cfe;font-family:-apple-system,Helvetica,sans-serif} | |
| header{padding:calc(10px + env(safe-area-inset-top)) 14px 8px;background:#0a1426;display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap} | |
| header h1{margin:0;font-size:17px;letter-spacing:2px} | |
| header a{color:#00ff88;text-decoration:none;font-size:13px} | |
| #wrap{display:grid;grid-template-columns:340px 1fr;height:calc(100% - 52px)} | |
| #ctl{overflow:auto;padding:10px;background:#060c18;border-right:1px solid #1b2a44} | |
| #out{overflow:auto;padding:10px;min-width:0} | |
| details{margin:6px 0;border:1px solid #1e3050;border-radius:12px;background:#0a1222} | |
| summary{font-size:17px;padding:12px;cursor:pointer;font-weight:600} | |
| .r{display:grid;grid-template-columns:105px 1fr 44px;gap:6px;align-items:center;padding:6px 12px;font-size:14px} | |
| .r output{text-align:right;color:#ffb000;font:13px ui-monospace,Menlo,monospace} | |
| textarea,select{width:100%;font-size:16px;padding:9px;background:#0b1220;color:#cfe;border:1px solid #2ec4ff;border-radius:8px} | |
| textarea{height:90px;margin:0 0 6px} | |
| .chk{display:flex;flex-wrap:wrap;gap:6px;padding:6px 12px} | |
| .chk label{background:#0b1220;border:1px solid #2a3c5c;border-radius:14px;padding:6px 10px;font-size:13px} | |
| button{font-size:15px;padding:10px 12px;border-radius:10px;border:1px solid #00ff88;background:#0b1220;color:#cfe;margin:4px 0} | |
| h2{font-size:14px;letter-spacing:2px;margin:14px 0 6px;color:#9fe} | |
| canvas{display:block;width:100%;image-rendering:pixelated;border:1px solid #1b2a44;border-radius:8px;background:#000} | |
| #tip{position:fixed;z-index:9;pointer-events:none;background:#000d;border:1px solid #2ec4ff;border-radius:8px;padding:6px 8px;font:12px ui-monospace,Menlo,monospace;display:none;max-width:80vw} | |
| #shards{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px} | |
| .shard{position:relative;padding:10px;border-radius:12px;background:linear-gradient(135deg,#ffffff18,#7fe3ff10 40%,#c070ff18);border:1px solid #9fe8ff66;backdrop-filter:blur(4px);font:11px ui-monospace,Menlo,monospace;word-break:break-all;cursor:pointer;transition:.2s;clip-path:polygon(0 8%,12% 0,100% 0,100% 88%,86% 100%,0 100%)} | |
| .shard.off{opacity:.18;filter:grayscale(1)} | |
| .shard b{display:block;font-size:13px;color:#fff;margin-bottom:4px} | |
| #verdict{padding:12px;border-radius:12px;margin:8px 0;font-size:16px;font-weight:600} | |
| .T{background:#164a2a}.F{background:#5a1a1a} | |
| @media(max-width:900px){#wrap{grid-template-columns:1fr;height:auto}#ctl{border-right:none;border-bottom:1px solid #1b2a44}body{overflow:auto}} | |
| </style></head><body> | |
| <header><h1>BOOLEAN GRADIENT GANTT</h1><span><a href="index.html">◂ Ghost dashboard</a> · <a href="https://huggingface.co/datasets/autobahn247365/mmr">MMR</a></span></header> | |
| <div id="wrap"> | |
| <div id="ctl"> | |
| <details open><summary>✎ COMMUNICATION</summary> | |
| <div style="padding:0 12px 8px"><textarea id="msg">All of our communications happen here. We get all the languages, twist them and blend them, and tie them together at the crypto level with glass sharding.</textarea> | |
| <select id="speaker"><option>brian</option><option>claude</option><option>sand</option></select></div> | |
| </details> | |
| <details open><summary>🌐 LANGUAGES · layers</summary> | |
| <div class="chk" id="langs"></div> | |
| </details> | |
| <details open><summary>🧶 TWIST · BLEND</summary> | |
| <div class="r"><span>Twist</span><input type="range" id="twist" min="0" max="16" value="3"><output id="o-twist"></output></div> | |
| <div class="r"><span>Blend</span><input type="range" id="blend" min="0" max="100" value="45"><output id="o-blend"></output></div> | |
| <div class="r"><span>Braid strands</span><input type="range" id="strands" min="2" max="8" value="3"><output id="o-strands"></output></div> | |
| </details> | |
| <details open><summary>⊨ BOOLEAN CONTROL</summary> | |
| <div class="r"><span>Gate</span><select id="gate" style="grid-column:2/4"><option>AND</option><option>OR</option><option selected>XOR</option><option>NAND</option><option>NOR</option><option>XNOR</option></select></div> | |
| <div class="r"><span>Invert (NOT)</span><input type="checkbox" id="not"><span></span></div> | |
| <div class="r"><span>Threshold</span><input type="range" id="thr" min="0" max="100" value="50"><output id="o-thr"></output></div> | |
| </details> | |
| <details open><summary>◈ CRYPTO · GLASS SHARDS</summary> | |
| <div class="r"><span>Shards (n)</span><input type="range" id="n" min="2" max="12" value="7"><output id="o-n"></output></div> | |
| <div class="r"><span>Needed (k)</span><input type="range" id="k" min="2" max="12" value="4"><output id="o-k"></output></div> | |
| <div style="padding:0 12px 10px"><button id="reshard">◈ Shard it</button> <button id="rebuild">⟲ Rebuild from lit shards</button></div> | |
| </details> | |
| <details><summary>⏱ GANTT · TIME</summary> | |
| <div class="r"><span>Cell size</span><input type="range" id="cell" min="3" max="18" value="8"><output id="o-cell"></output></div> | |
| <div class="r"><span>Gradient</span><select id="pal" style="grid-column:2/4"><option value="sand">SAND (cyan→gold→pink)</option><option value="glass">Glass (white→violet)</option><option value="mono">Boolean (black/white)</option></select></div> | |
| </details> | |
| </div> | |
| <div id="out"> | |
| <h2>GANTT · every grain addressed · rows = layers · columns = time</h2> | |
| <canvas id="g"></canvas> | |
| <h2>BOOLEAN RESULT · all layers through the gate</h2> | |
| <div id="verdict"></div> | |
| <h2>GLASS SHARDS · tap to turn a shard on/off · rebuild needs k of n</h2> | |
| <div id="shards"></div> | |
| <h2>FINGERPRINT · SHA-256 of the braid</h2> | |
| <div id="hash" style="font:12px ui-monospace,Menlo,monospace;word-break:break-all;color:#ffb000"></div> | |
| </div> | |
| </div> | |
| <div id="tip"></div> | |
| <script> | |
| const $=id=>document.getElementById(id); | |
| const enc=new TextEncoder(),dec=new TextDecoder(); | |
| const MORSE={a:'.-',b:'-...',c:'-.-.',d:'-..',e:'.',f:'..-.',g:'--.',h:'....',i:'..',j:'.---',k:'-.-',l:'.-..',m:'--',n:'-.',o:'---',p:'.--.',q:'--.-',r:'.-.',s:'...',t:'-',u:'..-',v:'...-',w:'.--',x:'-..-',y:'-.--',z:'--..','0':'-----','1':'.----','2':'..---','3':'...--','4':'....-','5':'.....','6':'-....','7':'--...','8':'---..','9':'----.'}; | |
| const bitsOf=bytes=>{const o=[];bytes.forEach(b=>{for(let i=7;i>=0;i--)o.push((b>>i)&1);});return o;}; | |
| const LANG={ | |
| 'UTF-8':m=>bitsOf(enc.encode(m)), | |
| 'UTF-16':m=>{const o=[];for(const ch of m){const c=ch.charCodeAt(0);for(let i=15;i>=0;i--)o.push((c>>i)&1);}return o;}, | |
| 'Hex':m=>bitsOf(enc.encode([...enc.encode(m)].map(b=>b.toString(16).padStart(2,'0')).join(''))), | |
| 'Base64':m=>bitsOf(enc.encode(btoa(unescape(encodeURIComponent(m))))), | |
| 'Morse':m=>{const o=[];for(const ch of m.toLowerCase()){const s=MORSE[ch];if(!s){o.push(0,0,0);continue;}for(const d of s){d==='.'?o.push(1,0):o.push(1,1,1,0);}o.push(0,0);}return o;}, | |
| 'Braille':m=>{const o=[];for(const ch of m){const c=ch.toLowerCase().charCodeAt(0)-96;const d=(c>0&&c<27)?[1,2,4,8,16,32].map(v=>((c*37)&v)?1:0):[0,0,0,0,0,0];o.push(...d);}return o;}, | |
| 'Binary (time)':m=>{const t=Date.now();const o=[];for(let i=0;i<m.length;i++){const v=(t+i)&255;for(let j=7;j>=0;j--)o.push((v>>j)&1);}return o;}, | |
| }; | |
| $('langs').innerHTML=Object.keys(LANG).map((k,i)=>`<label><input type="checkbox" value="${k}" ${i<5?'checked':''}> ${k}</label>`).join(''); | |
| const EXP=new Uint8Array(512),LOG=new Uint8Array(256);(()=>{let x=1;for(let i=0;i<255;i++){EXP[i]=x;LOG[x]=i;x^=x<<1;if(x&256)x^=0x11b;}for(let i=255;i<512;i++)EXP[i]=EXP[i-255];})(); | |
| const mul=(a,b)=>a&&b?EXP[LOG[a]+LOG[b]]:0,div=(a,b)=>a?EXP[(LOG[a]+255-LOG[b])%255]:0; | |
| function split(bytes,n,k){const sh=Array.from({length:n},(_,i)=>({x:i+1,y:new Uint8Array(bytes.length)})); | |
| for(let b=0;b<bytes.length;b++){const co=[bytes[b],...crypto.getRandomValues(new Uint8Array(k-1))]; | |
| sh.forEach(s=>{let y=0;for(let j=co.length-1;j>=0;j--)y=mul(y,s.x)^co[j];s.y[b]=y;});}return sh;} | |
| function combine(sh){const L=sh[0].y.length,out=new Uint8Array(L); | |
| for(let b=0;b<L;b++){let s=0;for(let i=0;i<sh.length;i++){let num=1,den=1;for(let j=0;j<sh.length;j++){if(i===j)continue;num=mul(num,sh[j].x);den=mul(den,sh[i].x^sh[j].x);}s^=mul(sh[i].y[b],div(num,den));}out[b]=s;}return out;} | |
| function braid(layers,twist,blend,strands){const len=Math.max(...layers.map(l=>l.length));const out=[]; | |
| for(let s=0;s<strands;s++){const row=[];for(let i=0;i<len;i++){const li=(s+Math.floor(i/(twist+1)))%layers.length;const a=layers[li][i%layers[li].length]||0;const nb=layers[(li+1)%layers.length];const b=nb[(i+s)%nb.length]||0;row.push((i*7+s*13)%100<blend?(a^b):a);}out.push(row);}return out;} | |
| const GATE={AND:(a,b)=>a&b,OR:(a,b)=>a|b,XOR:(a,b)=>a^b,NAND:(a,b)=>1-(a&b),NOR:(a,b)=>1-(a|b),XNOR:(a,b)=>1-(a^b)}; | |
| function pal(v,row,rows){const p=$('pal').value,t=row/Math.max(1,rows-1); | |
| if(p==='mono')return v?'#ffffff':'#000000'; | |
| if(p==='glass')return v?`hsl(${270-t*60},80%,${70+t*15}%)`:`hsl(260,40%,${6+t*6}%)`; | |
| return v?`hsl(${190-t*190},95%,${55+t*5}%)`:`hsl(220,60%,${5+t*5}%)`;} | |
| let GRID=[],SHARDS=[],ON=[],LAST=''; | |
| async function run(){ | |
| ['twist','blend','strands','thr','n','k','cell'].forEach(id=>$('o-'+id).textContent=$(id).value); | |
| if(+$('k').value>+$('n').value){$('k').value=$('n').value;$('o-k').textContent=$('k').value;} | |
| const m=$('msg').value||' ',spk=$('speaker').value,t0=Date.now(); | |
| const chosen=[...document.querySelectorAll('#langs input:checked')].map(c=>c.value);if(!chosen.length)return; | |
| const layers=chosen.map(k=>LANG[k](m)); | |
| const br=braid(layers,+$('twist').value,+$('blend').value,+$('strands').value); | |
| const g=GATE[$('gate').value],inv=$('not').checked; | |
| const len=br[0].length,gated=[];for(let i=0;i<len;i++){let v=br[0][i];for(let s=1;s<br.length;s++)v=g(v,br[s][i]);gated.push(inv?1-v:v);} | |
| GRID=[...chosen.map((k,i)=>({name:k,bits:layers[i]})),...br.map((b,i)=>({name:'braid '+(i+1),bits:b})),{name:'⊨ '+$('gate').value+(inv?' NOT':''),bits:gated}]; | |
| draw(spk,t0); | |
| const ones=gated.reduce((a,b)=>a+b,0),pct=Math.round(100*ones/gated.length),pass=pct>=+$('thr').value; | |
| $('verdict').className=pass?'T':'F';$('verdict').textContent=`${pass?'TRUE':'FALSE'} · ${pct}% of ${gated.length} grains lit · threshold ${$('thr').value}% · ${chosen.length} languages · ${br.length} strands`; | |
| const braidBytes=new Uint8Array(Math.ceil(gated.length/8));gated.forEach((b,i)=>{if(b)braidBytes[i>>3]|=128>>(i&7);}); | |
| const h=await crypto.subtle.digest('SHA-256',braidBytes);$('hash').textContent=[...new Uint8Array(h)].map(b=>b.toString(16).padStart(2,'0')).join(''); | |
| if(m!==LAST||SHARDS.length!==+$('n').value)shard();} | |
| function shard(){const m=$('msg').value,n=+$('n').value,k=+$('k').value;LAST=m;SHARDS=split(enc.encode(m),n,k);ON=SHARDS.map(()=>true);paintShards();} | |
| function paintShards(){ | |
| $('shards').innerHTML=SHARDS.map((s,i)=>`<div class="shard${ON[i]?'':' off'}" data-i="${i}"><b>◈ shard ${s.x}/${SHARDS.length}</b>${[...s.y.slice(0,24)].map(b=>b.toString(16).padStart(2,'0')).join('')}…</div>`).join(''); | |
| document.querySelectorAll('.shard').forEach(e=>e.onclick=()=>{ON[+e.dataset.i]=!ON[+e.dataset.i];paintShards();});} | |
| function rebuild(){const k=+$('k').value,lit=SHARDS.filter((s,i)=>ON[i]); | |
| if(lit.length<k){$('verdict').className='F';$('verdict').textContent=`FALSE · only ${lit.length} shards lit · need ${k} · message stays sealed`;return;} | |
| const txt=dec.decode(combine(lit.slice(0,k)));const ok=txt===$('msg').value;$('verdict').className=ok?'T':'F';$('verdict').textContent=`${ok?'TRUE · rebuilt from '+k+' shards':'FALSE · mismatch'} → “${txt.slice(0,140)}${txt.length>140?'…':''}”`;} | |
| function draw(spk,t0){const c=$('g'),cs=+$('cell').value,cols=Math.max(...GRID.map(r=>r.bits.length)),W=Math.min(cols,Math.floor(4000/cs)); | |
| c.width=W*cs;c.height=GRID.length*cs;const x=c.getContext('2d'); | |
| GRID.forEach((r,ri)=>{for(let i=0;i<W;i++){x.fillStyle=pal(r.bits[i%r.bits.length],ri,GRID.length);x.fillRect(i*cs,ri*cs,cs,cs);}}); | |
| const tip=e=>{const p=e.touches?e.touches[0]:e,b=c.getBoundingClientRect(),sx=c.width/b.width,col=Math.floor((p.clientX-b.left)*sx/cs),row=Math.floor((p.clientY-b.top)*sx/cs);const r=GRID[row];if(!r)return; | |
| const T=$('tip');T.style.display='block';T.style.left=Math.min(p.clientX+12,innerWidth-260)+'px';T.style.top=(p.clientY+12)+'px'; | |
| T.innerHTML=`cbg://${new Date(t0+col).toISOString()}/${spk}/${row}.${col}<br>layer: ${r.name} · bit: <b>${r.bits[col%r.bits.length]}</b><br>X ${col} · Y ${row} · Z ${GRID.length-1-row} · T +${col}ms · N ${spk}`;}; | |
| c.onmousemove=tip;c.ontouchstart=tip;c.ontouchmove=tip;c.onmouseleave=()=>$('tip').style.display='none';} | |
| document.querySelectorAll('input,select,textarea').forEach(e=>e.addEventListener('input',run)); | |
| $('langs').addEventListener('change',run); | |
| $('reshard').onclick=()=>{shard();run();};$('rebuild').onclick=rebuild; | |
| run(); | |
| </script></body></html> | |