# tests/runtime/test_director_predator_chase.py from proteus.game.runtime.multiagent_director import author_predator_chase def _run(): return author_predator_chase( seed=7, agent_starts=[(10, 30), (14, 38), (18, 24), (12, 46)], predator_start=(54, 31), ) def test_deterministic(): a, b = _run(), _run() assert a.model_dump_json() == b.model_dump_json() def test_ends_with_single_chosen_survivor(): ck = _run() last = ck.memory_turns[-1] alive = [a for a in last.agents if a.kind == "agent" and a.alive] assert len(alive) == 1 and alive[0].is_chosen and alive[0].id == "a0" assert ck.chosen_agent_id == "a0" def test_chosen_alive_every_turn_and_kills_recorded(): ck = _run() for t in ck.memory_turns: chosen = next(a for a in t.agents if a.id == "a0") assert chosen.alive all_events = [e for t in ck.memory_turns for e in t.events] assert sum("eaten" in e for e in all_events) == 3 # 3 distractors caught def test_persona_id_recorded(): assert _run().persona_weight_id == "risk_averse"