Pinball machine for developers. Ball is a deploy request, flippers are rollback/forward, bumpers are tests, tilt is rate limiting.
- JavaScript 100%
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-pinball
Pinball machine for developers. Ball is a deploy request, flippers are rollback/forward, bumpers are tests, tilt is rate limiting.
Usage
const { PinballMachine, BUMPER_TYPES, TARGET_TYPES } = require('./src/pinball');
const machine = new PinballMachine('Deploy Defender');
// Launch a ball (deploy request)
machine.newBall();
machine.launchBall(60);
// Play!
for (let i = 0; i < 200; i++) {
if (Math.random() < 0.3) machine.flipLeft(); // rollback
if (Math.random() < 0.3) machine.flipRight(); // fast-forward
machine.tick();
}
console.log(machine.tableView());
console.log(machine.report());
Bumpers
- Test Bumper (100 pts) — Hits all tests
- Lint Bumper (50 pts) — Code style check
- Security Bumper (200 pts) — Security scan
- Coverage Bumper (150 pts) — Code coverage
Targets
- Code Review (500 pts) — Get approval
- Sign-off (500 pts) — Stakeholder approval
- Canary Check (300 pts) — Canary deployment passed
- Hit ALL targets = 2000 pt bonus + multiplier increase!
Flippers
- Left (Rollback) — Saves the ball/deploy
- Right (Fast-Forward) — Keeps it going
Tilt System
Too many flips (rate limiting) triggers TILT — flippers disabled!