Castle for developers. Walls are firewalls, towers are services, dungeons are legacy, dragons are prod bugs.
  • JavaScript 100%
Find a file
2026-06-30 11:13:32 +00:00
node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 fix: e2e tests now use CommonJS require for node --test compatibility 2026-06-30 11:13:29 +00:00
src feat(#1): castle engine — towers, walls, garrison, dragons, siege, ASCII fortress 2026-06-15 06:40:10 +00:00
tests fix: e2e tests now use CommonJS require for node --test compatibility 2026-06-30 11:13:29 +00:00
package.json feat(#1): castle engine — towers, walls, garrison, dragons, siege, ASCII fortress 2026-06-15 06:40:10 +00:00
README.md feat(#1): castle engine — towers, walls, garrison, dragons, siege, ASCII fortress 2026-06-15 06:40:10 +00:00

code-castle

Castle for developers. Walls are firewalls, towers are services, dungeons are legacy, dragons are prod bugs.

Usage

const { Castle, ROLES, DRAGON_TYPES, TOWER_TYPES } = require('./src/castle');

const castle = new Castle('Production Keep');

// Recruit garrison
castle.recruit('Alice', ROLES.KNIGHT);
castle.recruit('Bob', ROLES.ARCHER);
castle.recruit('Carol', ROLES.MAGE);

// Assign defenders
castle.assign('api_gateway', 'Alice');
castle.assign('auth_keep', 'Bob');

// Dragon attacks!
castle.spawnDragon(DRAGON_TYPES.MEMORY_LEAK);

// Defend
castle.defend();
castle.dragonAttack();

// Repair and heal
castle.repairAll();
castle.healAll();

console.log(castle.fortressView());
console.log(castle.report());

Towers

  • API Gateway (DEF 40, HP 200) — Routes all incoming traffic
  • Auth Keep (DEF 60, HP 250) — Central authentication fortress
  • Database Vault (DEF 80, HP 300) — Maximum security treasure room
  • Cache Bastion (DEF 30, HP 150) — Fast response outpost
  • CDN Outpost (DEF 20, HP 100) — Edge towers, far-seeing
  • Queue Tower (DEF 45, HP 180) — Buffers incoming requests

Garrison

  • Knight (Developer) — Brute force bug fixing
  • Archer (QA) — Ranged test volleys
  • Mage (SRE) — Infrastructure spells
  • Healer (DevOps) — Keeps everyone alive
  • Scout (Monitor) — Early warning system
  • Berserker (Hotfixer) — Ships hotfixes at 3 AM

Dragons

  • Null Pointer (power 30) — Crashes everything
  • Race Condition (power 25) — Too fast to pin down
  • Memory Leak (power 20, HP 150) — Slow but unstoppable
  • SQL Injection (power 35) — Corrupts data
  • Dependency Hell (power 28) — Cut one head, two appear
  • DDoS Swarm (power 15, HP 40) — Thousands of them