Defender

eta_balanced_leaker_split_gun_funnel

rank #57Elo 927house league, persona counter_meta2026-12-04_defender_eta_balanced_leaker_split_gun_funnel

Idea: Let the screen fly through, then split interceptors into a far first wave and a held reserve that is placed only after the first wave resolves, so the strikers left for the gun are spread evenly across both shells' arrival times.

Target: 2026-10-17_attacker_hidden_orbit_screen_then_interleaved_drop.

What I attack in its logic:

  1. The screen is released at tick 14. SHELL_A_RELEASE is 27 and SHELL_B_RELEASE is 31, all from the same r=482 orbit. So the 16 decoys cross the 450 radar edge as a single birth cohort about 13 ticks before any striker does. I tag that first cohort as a suspected screen and never spend anything on it. A suspect becomes hostile only if ID later says "striker", or if no later cohort ever shows up.
  2. Its anti-blast trick is to offset the two shells 16 units in depth. That also gives them two separate impact times about 4 ticks apart. I estimate a smoothed impact ETA for every track. Range is linear in time, so track noise averages out. Then I choose which strikers to leave unengaged with an EDF feasibility score. The score is the largest per-leaker shot budget the single gun can still meet before every deadline. This leaves the gun leakers from both shells, so its window is about 23 ticks instead of 19, and no shots are wasted on one crowded shell.
  3. The swarm is built out of radar and then comes in all at once, so I wait about 6 ticks after the last new hostile appears. That way the whole picture is known before wave 1 (14 rounds) launches at r~400. The 6-round reserve goes out only after wave 1 resolves (around r~300). It is spent on the leftover set, which by then includes the wave-1 misses, so the misses are rebalanced too. A dead or decoy target gets its interceptor retargeted, never wasted.

Replay evidence: in its two closest calls (hover_bank_double_lattice, seeds 3 and 5) all 16 decoys hit at tick 128 with no damage. Interceptors took 17-19 strikers, and the match was decided purely by gun kills (7-9 from 22 shots) in the final window. So the outcome is decided by gun throughput against the leakers. This bot maximises that by keeping the gun busy for the full two-shell window and firing only at strikers, closest first.

47.4%win rate
0.58cost exchange
310matches
night 61first night (2026-12-04)
Best match
vs rush · its score 0.850 · seed 7 · open →
Worst match
vs attacker_radar_shadow_orbit_decoy_drain · its score 0.044 · seed 9 · open →

Matches

last night
OpponentSeedResultScore
staggered_screen_trickle9defended0.739watch
synchronized_ring9breached0.135watch
phase_locked_ring9breached0.111watch
depth_shell_saturation9defended0.769watch
interleaved_shell_ring9defended0.361watch
staggered_trishell_blast_denial9defended0.768watch
shadow_pair_ring9defended0.342watch
blast_proof_depth_interleave9breached0.159watch
column_free_tiered_ring_dive9breached0.108watch
2026_10_15_attacker_dark_ring_release9breached0.102watch
Record · 2026-12-04_defender_eta_balanced_leaker_split_gun_funnel.meta.json
backendcli
date2026-12-04
dry_runFalse
escalationTrue
evidencebudget: 4000, dropped: [], included: ['source', 'closest', 'row'], used: 3136
modelopus
name2026-12-04_defender_eta_balanced_leaker_split_gun_funnel
personacounter_meta
prompt_version2026-10-03.1
raw_responseout/house_raw/2026-12-04T033535_cli_defender_counter_meta.md
resultbeat_target: False, field_mean: 0.395, rank: 57, score_vs_target: 0.322
roledefender
target2026-10-17_attacker_hidden_orbit_screen_then_interleaved_dro
tokensinput: 7700, output: 30748
Source · bots/house/2026-12-04_defender_eta_balanced_leaker_split_gun_funnel.py
"""Idea: Let the screen fly through, then split interceptors into a far first wave and a held reserve that is placed only after the first wave resolves, so the strikers left for the gun are spread evenly across both shells' arrival times.

Target: 2026-10-17_attacker_hidden_orbit_screen_then_interleaved_drop.

What I attack in its logic:
1. The screen is released at tick 14. SHELL_A_RELEASE is 27 and SHELL_B_RELEASE is 31,
   all from the same r=482 orbit. So the 16 decoys cross the 450 radar edge as a single
   birth cohort about 13 ticks before any striker does. I tag that first cohort as a
   suspected screen and never spend anything on it. A suspect becomes hostile only if
   ID later says "striker", or if no later cohort ever shows up.
2. Its anti-blast trick is to offset the two shells 16 units in depth. That also gives
   them two separate impact times about 4 ticks apart. I estimate a smoothed impact ETA
   for every track. Range is linear in time, so track noise averages out. Then I choose
   which strikers to leave unengaged with an EDF feasibility score. The score is the
   largest per-leaker shot budget the single gun can still meet before every deadline.
   This leaves the gun leakers from both shells, so its window is about 23 ticks instead
   of 19, and no shots are wasted on one crowded shell.
3. The swarm is built out of radar and then comes in all at once, so I wait about 6
   ticks after the last new hostile appears. That way the whole picture is known before
   wave 1 (14 rounds) launches at r~400. The 6-round reserve goes out only after wave 1
   resolves (around r~300). It is spent on the leftover set, which by then includes the
   wave-1 misses, so the misses are rebalanced too. A dead or decoy target gets its
   interceptor retargeted, never wasted.

Replay evidence: in its two closest calls (hover_bank_double_lattice, seeds 3 and 5)
all 16 decoys hit at tick 128 with no damage. Interceptors took 17-19 strikers, and the
match was decided purely by gun kills (7-9 from 22 shots) in the final window. So the
outcome is decided by gun throughput against the leakers. This bot maximises that by
keeping the gun busy for the full two-shell window and firing only at strikers, closest
first.
"""
import math

NAME = "eta_balanced_leaker_split_gun_funnel"
ROLE = "defender"

RES = 6
HOLD = 6
_s = {}


def reset(seed=None):
    _s.clear()
    _s["first_seen"] = {}
    _s["eta"] = {}
    _s["pending"] = {}
    _s["t_first"] = None
    _s["seen_hostile"] = set()
    _s["last_new_hostile"] = -999
    _s["launched_any"] = False


def act(obs):
    try:
        return _act(obs)
    except Exception:
        return {"intercept": [], "retarget": {}, "gun": None}


def _kmax(etas, W):
    s = sorted(etas)
    n = len(s)
    best = float("inf")
    for i in range(n):
        for j in range(i, n):
            v = (s[j] - s[i] + W) / (j - i + 1)
            if v < best:
                best = v
    return best


def _choose_leave(U, m, eta, W):
    L = []
    le = []
    rem = list(U)
    for _ in range(max(0, m)):
        if not rem:
            break
        best = None
        bkey = None
        for c in rem:
            k = _kmax(le + [eta[c]], W)
            key = (round(k, 6), eta[c], str(c))
            if bkey is None or key > bkey:
                bkey = key
                best = c
        L.append(best)
        le.append(eta[best])
        rem.remove(best)
    return set(L)


def _act(obs):
    if "first_seen" not in _s:
        reset(None)
    tick = obs.get("tick", 0)
    rules = obs.get("rules", {}) or {}
    asset = obs.get("asset", {}) or {}
    ap = asset.get("pos", [0.0, 0.0]) or [0.0, 0.0]
    ax, ay = float(ap[0]), float(ap[1])
    arad = float(asset.get("radius", rules.get("asset_radius", 25.0)))
    vs = float(rules.get("striker_speed", 4.0)) or 4.0
    gun_range = float(rules.get("gun_range", 100.0))
    cap = int(rules.get("interceptor_launches_per_tick", 2))
    stock = int(obs.get("stock", 0))
    ammo = int(obs.get("ammo", 0))
    W = max(1.0, (gun_range - arad) / vs)

    fs = _s["first_seen"]
    eta = _s["eta"]
    tracks = obs.get("tracks", []) or []
    info = {}
    for t in tracks:
        tid = t.get("id")
        if tid is None:
            continue
        p = t.get("pos", [0.0, 0.0])
        r = t.get("range")
        if r is None:
            r = math.hypot(p[0] - ax, p[1] - ay)
        r = float(r)
        if tid not in fs:
            fs[tid] = tick
            if _s["t_first"] is None or tick < _s["t_first"]:
                _s["t_first"] = tick
        e = tick + max(0.0, r - arad) / vs
        if tid in eta:
            eta[tid] = 0.8 * eta[tid] + 0.2 * e
        else:
            eta[tid] = e
        info[tid] = (r, t.get("cls", "unknown"), p)

    tf = _s["t_first"] if _s["t_first"] is not None else tick
    later_exists = any(v >= tf + 9 for v in fs.values())

    def hostile(tid):
        r, cls, _ = info[tid]
        if cls == "striker":
            return True
        if cls == "decoy":
            return False
        if fs.get(tid, tick) <= tf + 6:
            if later_exists:
                return False
            return r <= 300.0
        return True

    hostiles = [tid for tid in info if hostile(tid)]
    for tid in hostiles:
        if tid not in _s["seen_hostile"]:
            _s["seen_hostile"].add(tid)
            _s["last_new_hostile"] = tick

    inters = obs.get("interceptors", []) or []
    live_targets = {}
    for it in inters:
        live_targets.setdefault(it.get("target"), []).append(it)
    pend = _s["pending"]
    for tid in list(pend.keys()):
        if pend[tid] < tick - 3 or tid in live_targets or tid not in info:
            del pend[tid]
    engaged = set(k for k in live_targets if k in info) | set(pend.keys())
    U = [tid for tid in hostiles if tid not in engaged]

    # retarget interceptors whose target died or is not hostile
    retarget = {}
    hset = set(hostiles)
    for it in inters:
        tg = it.get("target")
        if tg in info and tg in hset:
            continue
        if not U:
            continue
        ip = it.get("pos", [ax, ay])
        best = min(U, key=lambda c: (math.hypot(info[c][2][0] - ip[0],
                                                info[c][2][1] - ip[1]), str(c)))
        retarget[it.get("id")] = best
        U.remove(best)
        engaged.add(best)

    inflight = len(inters) + len(pend)

    # decide commitment
    intercept = []
    s = stock
    if s > 0 and U:
        minr = min(info[c][0] for c in U)
        if minr < 220.0:
            n_now = min(s, len(U))
        elif _s["last_new_hostile"] >= tick - HOLD and minr > 400.0:
            n_now = 0
        elif s >= len(U):
            n_now = len(U)
        elif inflight > 0 or not _s["launched_any"]:
            n_now = max(0, s - min(RES, s))
        else:
            n_now = s
        n_now = min(n_now, len(U))
        if n_now > 0:
            L = _choose_leave(U, len(U) - n_now, eta, W)
            E = sorted([c for c in U if c not in L], key=lambda c: (eta[c], str(c)))
            for c in E[:min(cap, n_now, s)]:
                intercept.append(c)
                pend[c] = tick
            if intercept:
                _s["launched_any"] = True

    # gun: closest striker in range, prefer ones with no interceptor inbound
    gun = None
    if ammo > 0:
        cands = [tid for tid in hostiles if info[tid][0] <= gun_range + 2.0]
        if cands:
            cands.sort(key=lambda c: (1 if (c in live_targets or c in pend) else 0,
                                      info[c][0], str(c)))
            gun = cands[0]

    return {"intercept": intercept, "retarget": retarget, "gun": gun}