This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // mosprite.hpp — compile-time sprite synthesis and n-dimensional rasterisation. | |
| // | |
| // A C++20 transcription of the MoSprites NG pipeline (mosprites-ng.md) in which | |
| // every stage parameter is a type. That is not decoration. Three things follow | |
| // from moving the policy into the type system, and only the first is about speed: | |
| // | |
| // 1. The inner loop contains no branch on operator, order, or colour space. | |
| // `if constexpr` deletes the untaken paths outright. | |
| // | |
| // 2. Dimension is a template parameter. ng §9 argues that the whole apparatus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| // ████ MATH EASING CURVES — intrinsically invertible pure functions ████ | |
| const EASE = { | |
| cubicInOut: t => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, | |
| cubicOut: t => 1 - Math.pow(1 - t, 3), | |
| backOut: t => { | |
| const c1 = 1.70158; | |
| const c3 = c1 + 1; | |
| return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // --- RETRO SOUND MANAGER --- | |
| class RetroSoundManager { | |
| constructor() { | |
| this.audioContext = null; | |
| this.masterGain = null; | |
| this.enabled = true; | |
| this.initAudio(); | |
| } | |
| initAudio() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * polyomino.js — D4 canonicalization and orientation analysis for polyominoes. | |
| * | |
| * A polyomino is represented as an array of [row, col] integer pairs. | |
| * No assumption about the grid it came from; coordinates can be any integers. | |
| * | |
| * Signatures are strings like "0,0|0,1|1,0" (an L-tromino), produced by | |
| * normalizing cells to origin and sorting them lexicographically. Two shapes | |
| * have the same signature iff they have the same cell layout at the same | |
| * translation; they have the same CANONICAL signature iff they are related |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ============================================================================= | |
| // ENCODERS (CPU — for demo generation) | |
| // ============================================================================= | |
| function fp16ToF32(u16){let s=(u16>>15)&1,e=(u16>>10)&0x1F,m=u16&0x3FF;if(e===0)return(s?-1:1)*Math.pow(2,-14)*(m/1024);if(e===31)return m?NaN:(s?-Infinity:Infinity);return(s?-1:1)*Math.pow(2,e-15)*(1+m/1024);} | |
| function bf16ToF32(u16){let s=(u16>>15)&1,e=(u16>>7)&0xFF,m=u16&0x7F;if(e===0)return(s?-1:1)*Math.pow(2,-126)*(m/128);if(e===255)return m?NaN:(s?-Infinity:Infinity);return(s?-1:1)*Math.pow(2,e-127)*(1+m/128);} | |
| function fp8E4M3ToF32(u8){let s=(u8>>7)&1,e=(u8>>3)&0xF,m=u8&0x7;if(e===0)return(s?-1:1)*Math.pow(2,-6)*(m/8);return(s?-1:1)*Math.pow(2,e-7)*(1+m/8);} | |
| function fp8E5M2ToF32(u8){let s=(u8>>7)&1,e=(u8>>2)&0x1F,m=u8&0x3;if(e===0)return(s?-1:1)*Math.pow(2,-14)*(m/4);return(s?-1:1)*Math.pow(2,e-15)*(1+m/4);} | |
| function fp4ToF32(u8){let s=(u8>>3)&1,e=(u8>>1)&0x3,m=u8&1;if(e===0)return(s?-1:1)*0.5*(m/2);r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Variable Bit-Depth Generator | |
| * @param {string} shape - 'lorenz', 'thomas', 'noise' | |
| * @param {number} depth - 8, 16, 32 | |
| * @param {num} number of points | |
| * @param {littleEndian} true or false | |
| */ | |
| function uintShapeGenerator(shape, depth, num, littleEndian ) { | |
| const compSize = depth / 8; | |
| const buf = new ArrayBuffer(num * compSize * 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function generateArtifactImage(signature) { | |
| // Convert signature (e.g. "0101-1110-...") into a more descriptive prompt | |
| const complexity = (signature.match(/1/g) || []).length; | |
| const prompt = `A mystical cosmic artifact, a geometric totem floating in space. | |
| The artifact has a ${complexity > 5 ? 'complex' : 'simple'} crystalline structure | |
| inspired by the pattern: ${signature}. Neon bioluminescent colors, | |
| ethereal nebula background, 8k, digital art, sci-fi relic.`; | |
| try { | |
| const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent?key=${apiKey}`, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Data type configuration constants | |
| const DATA_TYPES = { | |
| int8: { size: 1, min: -128, max: 127, method: 'getInt8' }, | |
| uint8: { size: 1, min: 0, max: 255, method: 'getUint8' }, | |
| int16: { size: 2, min: -32768, max: 32767, method: 'getInt16' }, | |
| uint16: { size: 2, min: 0, max: 65535, method: 'getUint16' }, | |
| int32: { size: 4, min: -2147483648, max: 2147483647, method: 'getInt32' }, | |
| uint32: { size: 4, min: 0, max: 4294967295, method: 'getUint32' } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
| <title>🎰 LATTICE SLOTS</title> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;600&display=swap'); | |
| * { box-sizing: border-box; margin: 0; padding: 0; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
| <title>BOXED IN - Instanced & Pooled</title> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;600&display=swap'); | |
| * { box-sizing: border-box; } |
NewerOlder