gitflarePublicPartly agent-ready40
orbit-duel
Real-time two-player orbital combat game on Cloudflare Workers and Durable Objects.
- LicenseApache-2.0
- LanguageJavaScript
- Last landed
0413e56Oct 23, 2026
Add the Apache-2.0 licence
0413e56export const CODE_RE = /^[A-HJ-NP-Z2-9]{6}$/;export function parseRoomPath(path) { const m = /^\/r\/([A-Za-z0-9]{6})$/.exec(path); return m && CODE_RE.test(m[1].toUpperCase()) ? m[1].toUpperCase() : null;}export function fmtTime(s) { s = Math.max(0, Math.floor(s)); return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0');}export function accuracy(shots, hits) { return shots > 0 ? Math.round((100 * hits) / shots) : 0;}export function rankResults(rows) { return rows.slice().sort((a, b) => b[2] - a[2] || a[3] - b[3]);}export function liveText(h) { if (!h || typeof h.players !== 'number') return ''; return h.players + (h.players === 1 ? ' player' : ' players') + ' in ' + h.rooms + (h.rooms === 1 ? ' room' : ' rooms');}export const FEED_MAX = 5;export const FEED_MS = 5000;export function feedIcon(kind) { return kind === 'crash' ? '☄' : '✕'; }export function colorFor(id) { return 'hsl(' + ((Number(id) * 67) % 360) + ',90%,60%)'; }export function deathText(killerName, secs) { return (killerName ? 'Destroyed by ' + killerName : 'Destroyed') + ' — respawning in ' + Math.max(0, Math.ceil(secs));}export function podium(rows) { return rankResults(rows).slice(0, 3); }