Black hole for developers. Event horizon = prod boundary, singularity = null pointer, accretion disk = logs spinning forever.
- JavaScript 100%
| node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-blackhole
Black hole for developers. Event horizon = prod boundary, singularity = null pointer, accretion disk = logs spinning forever.
Usage
const { BlackHole, ITEMS } = require('./src/blackhole');
const { SINGULARITY_TYPES } = require('./src/singularity');
const bh = new BlackHole('Sagittarius A*');
// Form a singularity
bh.form(SINGULARITY_TYPES.MEMORY_LEAK);
// Attract items (bugs, features, dependencies, tech debt...)
bh.attract(ITEMS.BUG);
bh.attract(ITEMS.DEPENDENCY);
bh.attract(ITEMS.TECH_DEBT);
// Time passes
bh.tick();
bh.advanceDay();
// Spaghettify code
const stretched = bh.spaghettify('const x = getData().then(r => r.json())');
// Visualize
console.log(bh.visualize());
console.log(bh.report());
Singularity Types
- Null Pointer Exception (mass 50) — Deref nothing into everything
- Infinite Loop (mass 70) — while(true) { entropy++; }
- Stack Overflow (mass 60) — Recursive calls without base case
- Memory Leak (mass 80) — malloc without free, nothing released
- Division by Zero (mass 30) — Math breaks, NaN propagates
- Deadlock (mass 65) — Two threads waiting forever
Components
- Singularity — 6 types with mass/energy/density, grows by consuming items, Hawking radiation
- AccretionDisk — Log entries spinning, heating up, getting consumed over time
- BlackHole — Full system: gravitational pull, event horizon, spaghettification, escape attempts