Defender

layered

rank #73Elo 863baselinelayered

Layered: prioritise by time to impact, keep interceptors back for confirmed strikers, and let the gun take whatever leaks through.

Tests whether a defender should think in time rather than distance, and whether holding magazine depth beats engaging everything early. Unknown tracks are engaged only when they are close enough that waiting for identification would cost the intercept, and the reserve shrinks as the match runs out of time for new threats to matter.

32.3%win rate
0.61cost exchange
310matches
night 1first night (2026-09-28)
Best match
vs rush · its score 0.807 · seed 9 · open →
Worst match
vs attacker_radar_shadow_orbit_decoy_drain · its score 0.047 · seed 5 · open →

Matches

last night
OpponentSeedResultScore
staggered_screen_trickle9breached0.132watch
synchronized_ring9breached0.130watch
phase_locked_ring9breached0.144watch
depth_shell_saturation9breached0.186watch
interleaved_shell_ring9breached0.147watch
staggered_trishell_blast_denial9breached0.176watch
shadow_pair_ring9defended0.581watch
blast_proof_depth_interleave9breached0.145watch
column_free_tiered_ring_dive9defended0.795watch
2026_10_15_attacker_dark_ring_release9defended0.775watch
Source · bots/defenders/layered.py
"""Layered: prioritise by time to impact, keep interceptors back for confirmed strikers,
and let the gun take whatever leaks through.

Tests whether a defender should think in time rather than distance, and whether holding
magazine depth beats engaging everything early. Unknown tracks are engaged only when they
are close enough that waiting for identification would cost the intercept, and the reserve
shrinks as the match runs out of time for new threats to matter.
"""
NAME = "layered"
ROLE = "defender"


def _time_to_impact(track, rules):
    speed = max(rules["striker_speed"], 1e-9)
    return max(0.0, (track["range"] - rules["asset_radius"]) / speed)


def act(obs):
    rules = obs["rules"]
    tracks = obs["tracks"]
    by_id = {t["id"]: t for t in tracks}
    engaged = {i["target"] for i in obs["interceptors"] if i["target"] in by_id}

    ranked = sorted(tracks, key=lambda t: _time_to_impact(t, rules))
    confirmed = [t for t in ranked if t["cls"] == "striker"]
    unknown_close = [t for t in ranked
                     if t["cls"] == "unknown" and _time_to_impact(t, rules) < 45.0]

    retarget, claimed = {}, set(engaged)
    free = [t for t in confirmed if t["id"] not in claimed]
    for i in obs["interceptors"]:
        if i["target"] not in by_id and free:
            t = free.pop(0)
            retarget[i["id"]] = t["id"]
            claimed.add(t["id"])

    # Hold some stock back early: a magazine emptied on the first wave cannot answer the
    # second. The reserve is released as the match runs out of time.
    ticks_left = max(0, rules["max_ticks"] - obs["tick"])
    reserve = 6 if ticks_left > 300 else (3 if ticks_left > 120 else 0)
    allowed = max(0, obs["stock"] - reserve)

    queue = [t for t in confirmed if t["id"] not in claimed]
    queue += [t for t in unknown_close if t["id"] not in claimed]
    intercept = [t["id"] for t in queue][:int(rules["interceptor_launches_per_tick"])]
    intercept = intercept[:allowed]

    gun_range = rules["gun_range"]
    leakers = [t for t in ranked if t["range"] <= gun_range and t["cls"] != "decoy"]
    if not leakers:
        leakers = [t for t in ranked if t["range"] <= gun_range]
    return {"intercept": intercept, "retarget": retarget,
            "gun": leakers[0]["id"] if leakers else None}