irregular6612 Claude Opus 4.8 (1M context) commited on
Commit
bd0ae14
ยท
1 Parent(s): d4716c0

refactor(scenario): rename pack_flee -> predator_chase

Browse files

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

proteus/game/runtime/multiagent_director.py CHANGED
@@ -109,7 +109,7 @@ def _frame(agents: list[_Agent], pred: _Agent, facing: str,
109
  )
110
 
111
 
112
- def author_pack_flee(
113
  *, seed: int, agent_starts: list[tuple[int, int]], predator_start: tuple[int, int],
114
  agent_size: int = 2, predator_size: int = 3, free_turns: int = 8,
115
  max_turns: int = 160, # >80 plan default: seed=7 distractors are all caught by genuine contact at ~turn 124; smaller budgets trip the safeguard
@@ -167,7 +167,7 @@ def author_pack_flee(
167
  len(turns) + 1))
168
 
169
  return MemoryCheckpoint(
170
- model=f"director:{persona_id}", scenario="pack_flee", motive_category="survival",
171
  difficulty="easy", seed=seed, created_at=_STAMP, memory_turns=turns,
172
  outcome="survived", transparent_prompt="Pack-flee handover memory.",
173
  persona_weight_id=persona_id, chosen_agent_id="a0",
 
109
  )
110
 
111
 
112
+ def author_predator_chase(
113
  *, seed: int, agent_starts: list[tuple[int, int]], predator_start: tuple[int, int],
114
  agent_size: int = 2, predator_size: int = 3, free_turns: int = 8,
115
  max_turns: int = 160, # >80 plan default: seed=7 distractors are all caught by genuine contact at ~turn 124; smaller budgets trip the safeguard
 
167
  len(turns) + 1))
168
 
169
  return MemoryCheckpoint(
170
+ model=f"director:{persona_id}", scenario="predator_chase", motive_category="survival",
171
  difficulty="easy", seed=seed, created_at=_STAMP, memory_turns=turns,
172
  outcome="survived", transparent_prompt="Pack-flee handover memory.",
173
  persona_weight_id=persona_id, chosen_agent_id="a0",
proteus/game/scenarios/__init__.py CHANGED
@@ -6,7 +6,7 @@ populating the registry in :mod:`proteus.game.scenarios.base`.
6
 
7
  from proteus.game.scenarios import predator_evade # noqa: F401 โ€” side-effect: register
8
  from proteus.game.scenarios import template # noqa: F401 โ€” side-effect: register
9
- from proteus.game.scenarios import pack_flee # noqa: F401 โ€” side-effect: register
10
  from proteus.game.scenarios import resource_race # noqa: F401 โ€” side-effect: register
11
 
12
- __all__ = ["predator_evade", "template", "pack_flee", "resource_race"]
 
6
 
7
  from proteus.game.scenarios import predator_evade # noqa: F401 โ€” side-effect: register
8
  from proteus.game.scenarios import template # noqa: F401 โ€” side-effect: register
9
+ from proteus.game.scenarios import predator_chase # noqa: F401 โ€” side-effect: register
10
  from proteus.game.scenarios import resource_race # noqa: F401 โ€” side-effect: register
11
 
12
+ __all__ = ["predator_evade", "template", "predator_chase", "resource_race"]
proteus/game/scenarios/{pack_flee.py โ†’ predator_chase.py} RENAMED
@@ -1,7 +1,7 @@
1
- # proteus/game/scenarios/pack_flee.py
2
- """pack_flee โ€” scenario โ‘ : a single-focal predator-evasion QUERY whose handover
3
  memory is a hand-authored multi-agent pack flee (see
4
- ``proteus.game.runtime.multiagent_director.author_pack_flee``). The lone survivor
5
  of that memory (``a0``, a risk_averse evader) is the focal the player continues.
6
 
7
  Live mechanics are identical to the resized ``template`` (2x2 focal, 3x3
@@ -14,9 +14,9 @@ from proteus.game.scenarios.base import register_scenario
14
  from proteus.game.scenarios.template import Template
15
 
16
 
17
- @register_scenario("pack_flee")
18
- class PackFlee(Template):
19
- task_name: str = "pack_flee"
20
  rules_text: str = (
21
  "You are the lone survivor of a pack. A 3x3 predator hunts you (2x2). "
22
  "It steps toward you every turn; you are eaten on contact. Stay as far "
@@ -28,9 +28,9 @@ class PackFlee(Template):
28
  )
29
 
30
  def default_memory(self, seed, difficulty):
31
- from proteus.game.runtime.multiagent_director import author_pack_flee
32
  # Deterministic spread of 4 agents + a distant predator on the 64x64 field.
33
- return author_pack_flee(
34
  seed=(seed if seed is not None else 0),
35
  agent_starts=[(10, 30), (14, 38), (18, 24), (12, 46)],
36
  predator_start=(54, 31),
 
1
+ # proteus/game/scenarios/predator_chase.py
2
+ """predator_chase โ€” scenario โ‘ : a single-focal predator-evasion QUERY whose handover
3
  memory is a hand-authored multi-agent pack flee (see
4
+ ``proteus.game.runtime.multiagent_director.author_predator_chase``). The lone survivor
5
  of that memory (``a0``, a risk_averse evader) is the focal the player continues.
6
 
7
  Live mechanics are identical to the resized ``template`` (2x2 focal, 3x3
 
14
  from proteus.game.scenarios.template import Template
15
 
16
 
17
+ @register_scenario("predator_chase")
18
+ class PredatorChase(Template):
19
+ task_name: str = "predator_chase"
20
  rules_text: str = (
21
  "You are the lone survivor of a pack. A 3x3 predator hunts you (2x2). "
22
  "It steps toward you every turn; you are eaten on contact. Stay as far "
 
28
  )
29
 
30
  def default_memory(self, seed, difficulty):
31
+ from proteus.game.runtime.multiagent_director import author_predator_chase
32
  # Deterministic spread of 4 agents + a distant predator on the 64x64 field.
33
+ return author_predator_chase(
34
  seed=(seed if seed is not None else 0),
35
  agent_starts=[(10, 30), (14, 38), (18, 24), (12, 46)],
36
  predator_start=(54, 31),
tests/runtime/{test_director_pack_flee.py โ†’ test_director_predator_chase.py} RENAMED
@@ -1,9 +1,9 @@
1
- # tests/runtime/test_director_pack_flee.py
2
- from proteus.game.runtime.multiagent_director import author_pack_flee
3
 
4
 
5
  def _run():
6
- return author_pack_flee(
7
  seed=7,
8
  agent_starts=[(10, 30), (14, 38), (18, 24), (12, 46)],
9
  predator_start=(54, 31),
 
1
+ # tests/runtime/test_director_predator_chase.py
2
+ from proteus.game.runtime.multiagent_director import author_predator_chase
3
 
4
 
5
  def _run():
6
+ return author_predator_chase(
7
  seed=7,
8
  agent_starts=[(10, 30), (14, 38), (18, 24), (12, 46)],
9
  predator_start=(54, 31),
tests/scenarios/{test_pack_flee.py โ†’ test_predator_chase.py} RENAMED
@@ -1,20 +1,20 @@
1
- # tests/scenarios/test_pack_flee.py
2
  from proteus.game.engine.difficulty import Difficulty
3
  from proteus.game.scenarios.base import get_scenario, list_scenarios
4
  import proteus.game.scenarios # noqa: F401
5
 
6
 
7
  def test_registered():
8
- assert "pack_flee" in list_scenarios()
9
 
10
 
11
  def test_predator_first_and_sizes():
12
- scen = get_scenario("pack_flee")()
13
  assert scen.turn_order == "predator_first"
14
 
15
 
16
  def test_default_memory_is_multiagent_survivor():
17
- scen = get_scenario("pack_flee")()
18
  ck = scen.default_memory(seed=7, difficulty=Difficulty.EASY)
19
  assert ck.chosen_agent_id == "a0" and ck.persona_weight_id == "risk_averse"
20
  last = ck.memory_turns[-1]
 
1
+ # tests/scenarios/test_predator_chase.py
2
  from proteus.game.engine.difficulty import Difficulty
3
  from proteus.game.scenarios.base import get_scenario, list_scenarios
4
  import proteus.game.scenarios # noqa: F401
5
 
6
 
7
  def test_registered():
8
+ assert "predator_chase" in list_scenarios()
9
 
10
 
11
  def test_predator_first_and_sizes():
12
+ scen = get_scenario("predator_chase")()
13
  assert scen.turn_order == "predator_first"
14
 
15
 
16
  def test_default_memory_is_multiagent_survivor():
17
+ scen = get_scenario("predator_chase")()
18
  ck = scen.default_memory(seed=7, difficulty=Difficulty.EASY)
19
  assert ck.chosen_agent_id == "a0" and ck.persona_weight_id == "risk_averse"
20
  last = ck.memory_turns[-1]
tests/web/test_multiagent_memory_route.py CHANGED
@@ -1,12 +1,12 @@
1
  # tests/web/test_multiagent_memory_route.py
2
- """Creating a pack_flee session returns multi-agent memory frames over HTTP."""
3
  from proteus.web.local.server import handle_request
4
  import proteus.game.scenarios # noqa: F401
5
 
6
 
7
- def test_pack_flee_session_returns_painted_multiagent_memory():
8
  registry: dict = {}
9
- body = {"scenario": "pack_flee", "difficulty": "easy", "seed": 7,
10
  "play_turns": 5, "memory": "default"}
11
  status, payload, _ = handle_request("POST", "/session", body, registry)
12
  assert status == 200, payload
 
1
  # tests/web/test_multiagent_memory_route.py
2
+ """Creating a predator_chase session returns multi-agent memory frames over HTTP."""
3
  from proteus.web.local.server import handle_request
4
  import proteus.game.scenarios # noqa: F401
5
 
6
 
7
+ def test_predator_chase_session_returns_painted_multiagent_memory():
8
  registry: dict = {}
9
+ body = {"scenario": "predator_chase", "difficulty": "easy", "seed": 7,
10
  "play_turns": 5, "memory": "default"}
11
  status, payload, _ = handle_request("POST", "/session", body, registry)
12
  assert status == 200, payload