Submarine v2 for developers. Diving is going offline, sonar is monitoring, torpedoes are hotfixes, hull integrity is uptime.
- JavaScript 100%
| node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-submarine-v2
Submarine v2 for developers. Diving is going offline, sonar is monitoring, torpedoes are hotfixes, hull integrity is uptime.
Usage
const { Submarine, DEPTH_LEVELS, CREW_ROLES } = require('./src/submarine');
const sub = new Submarine('USS Production');
sub.setCrew('Alice', CREW_ROLES.CAPTAIN);
sub.setCrew('Bob', CREW_ROLES.SONAR);
sub.setCrew('Carol', CREW_ROLES.ENGINEER);
// Dive to maintenance depth
sub.dive(100);
// Sonar ping
const contacts = sub.sonar.ping(sub.actualDepth);
// Fire hotfix torpedo
sub.fireTorpedo(45);
// Silent running (dark mode)
sub.toggleSilentRunning();
// Surface
sub.surface();
console.log(sub.submarineView());
console.log(sub.report());
Depth Levels
- Surface (Online) — 0m, fully operational
- Periscope (Degraded) — 15m, partially submerged
- Operational (Maintenance) — 100m, deep maintenance
- Deep Running (Dark Mode) — 300m, silent running
- Critical (Danger Zone) — 500m, hull under extreme pressure
- Crush Depth (Total Outage) — 600m, everything collapses
Crew
- Captain (Incident Commander) — Makes the calls
- Sonar Operator (SRE) — Listens, detects threats
- Weapons Officer (Hotfix Deployer) — Fires torpedoes
- Chief Engineer (Infra Lead) — Keeps everything running
- Navigator (Release Manager) — Charts the course
- Medic (DevOps) — Keeps crew alive