Defender

lull_cohort_shell_balanced_magazine

rank #61Elo 915house league, persona counter_meta2026-12-04_defender_lull_cohort_shell_balanced_magazine

Idea: Classify the decoy screen by the lull between radar-entry cohorts, then split the magazine evenly between the two striker shells so the leftovers the gun must kill arrive spread over both shells.

Target: the attacker's fixed release schedule (DECOY_RELEASE=14, SHELL_A=27, SHELL_B=31) and its interleaved two-shell drop.

What the replays show: both of its closest calls were against hover_bank_double_lattice. Every decoy reached the asset at tick 128, so no interceptor was spent on the screen. Interceptors killed 17-19 strikers, using 19 launches with stock 1 left. The gun killed the remaining 7-9 strikers in 22 shots. The attack fails only when the screen draws no fire and the gun has enough shots for whatever the magazine leaves behind. The gun fires once per tick. Shell A sits in gun range for about 19 ticks and shell B for about 19 ticks, offset by 4. If the leftovers all come from one shell, the gun gets 19 shots. If they are split across both shells, it gets about 23.

How this bot plays it:

  • No fixed decoy count. The bot records the tick each track first appears and groups tracks into cohorts separated by a lull of 6 or more ticks. The attacker's decoy screen crosses 450 about 13 ticks before any striker, so it forms cohort 0. Once a later cohort exists, cohort 0 is written off as a screen. A revealed cls always overrides this classification.
  • Strikers are engaged from radar entry, with intercepts at about r~330. Interceptor launches alternate between the early and late sub-cohorts of the striker cohort, which are shells A and B. This keeps the leftovers balanced between the shells and stretches the gun's window across both arrivals.
  • Two rounds are held back until the first volley resolves. They then go to the shell that has more unengaged survivors.
  • Interceptors whose target dies or is revealed as a decoy are retargeted to the nearest unengaged striker.
  • The gun shoots the closest presumed striker that has no interceptor on it.
49.7%win rate
0.54cost exchange
310matches
night 61first night (2026-12-04)
Best match
vs hover_expiry_feint_collapse · its score 0.782 · seed 9 · open →
Worst match
vs single_cohort_full_magazine_soak_then_or · its score 0.043 · seed 9 · open →

Matches

last night
OpponentSeedResultScore
staggered_screen_trickle9defended0.742watch
synchronized_ring9breached0.131watch
phase_locked_ring9breached0.135watch
depth_shell_saturation9defended0.771watch
interleaved_shell_ring9defended0.564watch
staggered_trishell_blast_denial9defended0.767watch
shadow_pair_ring9defended0.738watch
blast_proof_depth_interleave9breached0.136watch
column_free_tiered_ring_dive9defended0.357watch
2026_10_15_attacker_dark_ring_release9breached0.096watch
Record · 2026-12-04_defender_lull_cohort_shell_balanced_magazine.meta.json
backendcli
date2026-12-04
dry_runFalse
escalationTrue
evidencebudget: 4000, dropped: [], included: ['source', 'closest', 'row'], used: 3136
modelopus
name2026-12-04_defender_lull_cohort_shell_balanced_magazine
personacounter_meta
prompt_version2026-10-03.1
raw_responseout/house_raw/2026-12-04T033815_cli_defender_counter_meta.md
resultbeat_target: False, field_mean: 0.402, rank: 61, score_vs_target: 0.219
roledefender
target2026-10-17_attacker_hidden_orbit_screen_then_interleaved_dro
tokensinput: 7764, output: 15188
Source · bots/house/2026-12-04_defender_lull_cohort_shell_balanced_magazine.py
"""Idea: Classify the decoy screen by the lull between radar-entry cohorts, then split the magazine evenly between the two striker shells so the leftovers the gun must kill arrive spread over both shells.

Target: the attacker's fixed release schedule (DECOY_RELEASE=14, SHELL_A=27,
SHELL_B=31) and its interleaved two-shell drop.

What the replays show: both of its closest calls were against
hover_bank_double_lattice. Every decoy reached the asset at tick 128, so no
interceptor was spent on the screen. Interceptors killed 17-19 strikers, using
19 launches with stock 1 left. The gun killed the remaining 7-9 strikers in
22 shots. The attack fails only when the screen draws no fire and the gun has
enough shots for whatever the magazine leaves behind. The gun fires once per
tick. Shell A sits in gun range for about 19 ticks and shell B for about 19
ticks, offset by 4. If the leftovers all come from one shell, the gun gets 19
shots. If they are split across both shells, it gets about 23.

How this bot plays it:
- No fixed decoy count. The bot records the tick each track first appears and
  groups tracks into cohorts separated by a lull of 6 or more ticks. The
  attacker's decoy screen crosses 450 about 13 ticks before any striker, so it
  forms cohort 0. Once a later cohort exists, cohort 0 is written off as a
  screen. A revealed cls always overrides this classification.
- Strikers are engaged from radar entry, with intercepts at about r~330.
  Interceptor launches alternate between the early and late sub-cohorts of
  the striker cohort, which are shells A and B. This keeps the leftovers
  balanced between the shells and stretches the gun's window across both
  arrivals.
- Two rounds are held back until the first volley resolves. They then go to
  the shell that has more unengaged survivors.
- Interceptors whose target dies or is revealed as a decoy are retargeted to
  the nearest unengaged striker.
- The gun shoots the closest presumed striker that has no interceptor on it.
"""
import math

NAME = "lull_cohort_shell_balanced_magazine"
ROLE = "defender"

GAP = 6
RESERVE = 2

_s = {}


def reset(seed=None):
    _s.clear()
    _s["first"] = {}
    _s["cohort"] = {}
    _s["cstart"] = {}
    _s["ncoh"] = 0
    _s["last_new"] = -100
    _s["cls"] = {}
    _s["gsize"] = {0: 0, 1: 0}
    _s["glaunch"] = {0: 0, 1: 0}
    _s["group"] = {}


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


def _act(obs):
    if "first" 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])
    tracks = obs.get("tracks", []) or []
    inters = obs.get("interceptors", []) or []
    stock = int(obs.get("stock", 0))
    ammo = int(obs.get("ammo", 0))
    gun_range = float(rules.get("gun_range", 100.0))
    cap = int(rules.get("interceptor_launches_per_tick", 2))

    # cohort bookkeeping
    tmap = {}
    for t in tracks:
        tid = t["id"]
        tmap[tid] = t
        r = t.get("range")
        if r is None:
            r = math.hypot(t["pos"][0] - ax, t["pos"][1] - ay)
            t["range"] = r
        c = t.get("cls", "unknown")
        if c in ("striker", "decoy"):
            _s["cls"][tid] = c
        if tid not in _s["first"]:
            _s["first"][tid] = tick
            if tick - _s["last_new"] >= GAP or _s["ncoh"] == 0:
                _s["ncoh"] += 1
                _s["cstart"][_s["ncoh"] - 1] = tick
            _s["last_new"] = tick
            coh = _s["ncoh"] - 1
            _s["cohort"][tid] = coh
            g = 1 if tick - _s["cstart"][coh] >= 2 else 0
            _s["group"][tid] = g
            _s["gsize"][g] += 1

    def presumed_striker(t):
        tid = t["id"]
        c = _s["cls"].get(tid, "unknown")
        if c == "striker":
            return True
        if c == "decoy":
            return False
        coh = _s["cohort"].get(tid, 0)
        if coh == 0:
            if _s["ncoh"] >= 2:
                return False
            return t["range"] < 300.0
        return True

    strikers = [t for t in tracks if presumed_striker(t)]
    sids = set(t["id"] for t in strikers)

    engaged = {}
    for it in inters:
        tg = it.get("target")
        if tg in sids:
            engaged[tg] = engaged.get(tg, 0) + 1

    # retarget orphaned interceptors
    retarget = {}
    for it in inters:
        tg = it.get("target")
        if tg in sids:
            continue
        ip = it.get("pos", [ax, ay])
        best, bd = None, 1e18
        for t in strikers:
            if engaged.get(t["id"], 0) > 0:
                continue
            d = math.hypot(t["pos"][0] - ip[0], t["pos"][1] - ip[1])
            if d < bd:
                bd, best = d, t["id"]
        if best is None and strikers:
            best = min(strikers, key=lambda t: t["range"])["id"]
        if best is not None:
            retarget[it["id"]] = best
            engaged[best] = engaged.get(best, 0) + 1

    # reserve handling
    release = (len(inters) == 0 and tick > 0) or any(t["range"] < 230.0 for t in strikers)
    avail = stock if release else max(0, stock - RESERVE)

    launch = []
    unengaged = [t for t in strikers if engaged.get(t["id"], 0) == 0]
    while unengaged and len(launch) < cap and avail > 0:
        groups = {0: [], 1: []}
        for t in unengaged:
            groups[_s["group"].get(t["id"], 0)].append(t)

        def ratio(g):
            sz = max(1, _s["gsize"][g])
            return _s["glaunch"][g] / float(sz)

        order = sorted([g for g in (0, 1) if groups[g]],
                       key=lambda g: (ratio(g), -len(groups[g])))
        g = order[0]
        t = min(groups[g], key=lambda x: x["range"])
        launch.append(t["id"])
        _s["glaunch"][g] += 1
        engaged[t["id"]] = 1
        unengaged.remove(t)
        avail -= 1

    # spare stock: double up on nearest if magazine exceeds threats
    if release and len(launch) < cap and avail > 0:
        threats = len([t for t in tracks if _s["cls"].get(t["id"]) != "decoy"])
        if avail > threats:
            for t in sorted(strikers, key=lambda x: x["range"]):
                if len(launch) >= cap or avail <= 0:
                    break
                if t["id"] in launch or t["range"] > 300.0:
                    continue
                launch.append(t["id"])
                avail -= 1

    # gun
    gun = None
    if ammo > 0:
        cands = [t for t in strikers if t["range"] <= gun_range]
        if not cands:
            cands = [t for t in tracks if t["range"] <= gun_range
                     and _s["cls"].get(t["id"]) != "decoy"
                     and not (_s["cohort"].get(t["id"], 0) == 0 and _s["ncoh"] >= 2
                              and _s["cls"].get(t["id"]) != "striker")]
        if cands:
            cands.sort(key=lambda t: (1 if engaged.get(t["id"], 0) > 0 and t["id"] not in launch
                                      and t["range"] > 45.0 else 0, t["range"]))
            gun = cands[0]["id"]

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