cogames 0.3.49__py3-none-any.whl → 0.3.64__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. cogames/cli/client.py +60 -6
  2. cogames/cli/docsync/__init__.py +0 -0
  3. cogames/cli/docsync/_nb_md_directive_processing.py +180 -0
  4. cogames/cli/docsync/_nb_md_sync.py +103 -0
  5. cogames/cli/docsync/_nb_py_sync.py +122 -0
  6. cogames/cli/docsync/_three_way_sync.py +115 -0
  7. cogames/cli/docsync/_utils.py +76 -0
  8. cogames/cli/docsync/docsync.py +156 -0
  9. cogames/cli/leaderboard.py +112 -28
  10. cogames/cli/mission.py +64 -53
  11. cogames/cli/policy.py +46 -10
  12. cogames/cli/submit.py +268 -67
  13. cogames/cogs_vs_clips/cog.py +79 -0
  14. cogames/cogs_vs_clips/cogs_vs_clips_mapgen.md +19 -16
  15. cogames/cogs_vs_clips/cogsguard_reward_variants.py +153 -0
  16. cogames/cogs_vs_clips/cogsguard_tutorial.py +56 -0
  17. cogames/cogs_vs_clips/evals/README.md +10 -16
  18. cogames/cogs_vs_clips/evals/cogsguard_evals.py +81 -0
  19. cogames/cogs_vs_clips/evals/diagnostic_evals.py +49 -444
  20. cogames/cogs_vs_clips/evals/difficulty_variants.py +13 -326
  21. cogames/cogs_vs_clips/evals/integrated_evals.py +5 -45
  22. cogames/cogs_vs_clips/evals/spanning_evals.py +9 -180
  23. cogames/cogs_vs_clips/mission.py +187 -146
  24. cogames/cogs_vs_clips/missions.py +46 -137
  25. cogames/cogs_vs_clips/procedural.py +8 -8
  26. cogames/cogs_vs_clips/sites.py +107 -3
  27. cogames/cogs_vs_clips/stations.py +198 -186
  28. cogames/cogs_vs_clips/tutorial_missions.py +1 -1
  29. cogames/cogs_vs_clips/variants.py +25 -476
  30. cogames/device.py +13 -1
  31. cogames/{policy/scripted_agent/README.md → docs/SCRIPTED_AGENT.md} +82 -58
  32. cogames/evaluate.py +18 -30
  33. cogames/main.py +1434 -243
  34. cogames/maps/canidate1_1000.map +1 -1
  35. cogames/maps/canidate1_1000_stations.map +2 -2
  36. cogames/maps/canidate1_500.map +1 -1
  37. cogames/maps/canidate1_500_stations.map +2 -2
  38. cogames/maps/canidate2_1000.map +1 -1
  39. cogames/maps/canidate2_1000_stations.map +2 -2
  40. cogames/maps/canidate2_500.map +1 -1
  41. cogames/maps/canidate2_500_stations.map +2 -2
  42. cogames/maps/canidate3_1000.map +1 -1
  43. cogames/maps/canidate3_1000_stations.map +2 -2
  44. cogames/maps/canidate3_500.map +1 -1
  45. cogames/maps/canidate3_500_stations.map +2 -2
  46. cogames/maps/canidate4_500.map +1 -1
  47. cogames/maps/canidate4_500_stations.map +2 -2
  48. cogames/maps/cave_base_50.map +2 -2
  49. cogames/maps/diagnostic_evals/diagnostic_agile.map +2 -2
  50. cogames/maps/diagnostic_evals/diagnostic_agile_hard.map +2 -2
  51. cogames/maps/diagnostic_evals/diagnostic_charge_up.map +2 -2
  52. cogames/maps/diagnostic_evals/diagnostic_charge_up_hard.map +2 -2
  53. cogames/maps/diagnostic_evals/diagnostic_chest_navigation1.map +2 -2
  54. cogames/maps/diagnostic_evals/diagnostic_chest_navigation1_hard.map +2 -2
  55. cogames/maps/diagnostic_evals/diagnostic_chest_navigation2.map +2 -2
  56. cogames/maps/diagnostic_evals/diagnostic_chest_navigation2_hard.map +2 -2
  57. cogames/maps/diagnostic_evals/diagnostic_chest_navigation3.map +2 -2
  58. cogames/maps/diagnostic_evals/diagnostic_chest_navigation3_hard.map +2 -2
  59. cogames/maps/diagnostic_evals/diagnostic_chest_near.map +2 -2
  60. cogames/maps/diagnostic_evals/diagnostic_chest_search.map +2 -2
  61. cogames/maps/diagnostic_evals/diagnostic_chest_search_hard.map +2 -2
  62. cogames/maps/diagnostic_evals/diagnostic_extract_lab.map +2 -2
  63. cogames/maps/diagnostic_evals/diagnostic_extract_lab_hard.map +2 -2
  64. cogames/maps/diagnostic_evals/diagnostic_memory.map +2 -2
  65. cogames/maps/diagnostic_evals/diagnostic_memory_hard.map +2 -2
  66. cogames/maps/diagnostic_evals/diagnostic_radial.map +2 -2
  67. cogames/maps/diagnostic_evals/diagnostic_radial_hard.map +2 -2
  68. cogames/maps/diagnostic_evals/diagnostic_resource_lab.map +2 -2
  69. cogames/maps/diagnostic_evals/diagnostic_unclip.map +2 -2
  70. cogames/maps/evals/eval_balanced_spread.map +9 -5
  71. cogames/maps/evals/eval_clip_oxygen.map +9 -5
  72. cogames/maps/evals/eval_collect_resources.map +9 -5
  73. cogames/maps/evals/eval_collect_resources_hard.map +9 -5
  74. cogames/maps/evals/eval_collect_resources_medium.map +9 -5
  75. cogames/maps/evals/eval_divide_and_conquer.map +9 -5
  76. cogames/maps/evals/eval_energy_starved.map +9 -5
  77. cogames/maps/evals/eval_multi_coordinated_collect_hard.map +9 -5
  78. cogames/maps/evals/eval_oxygen_bottleneck.map +9 -5
  79. cogames/maps/evals/eval_single_use_world.map +9 -5
  80. cogames/maps/evals/extractor_hub_100x100.map +9 -5
  81. cogames/maps/evals/extractor_hub_30x30.map +9 -5
  82. cogames/maps/evals/extractor_hub_50x50.map +9 -5
  83. cogames/maps/evals/extractor_hub_70x70.map +9 -5
  84. cogames/maps/evals/extractor_hub_80x80.map +9 -5
  85. cogames/maps/machina_100_stations.map +2 -2
  86. cogames/maps/machina_200_stations.map +2 -2
  87. cogames/maps/machina_200_stations_small.map +2 -2
  88. cogames/maps/machina_eval_exp01.map +2 -2
  89. cogames/maps/machina_eval_template_large.map +2 -2
  90. cogames/maps/machinatrainer4agents.map +2 -2
  91. cogames/maps/machinatrainer4agentsbase.map +2 -2
  92. cogames/maps/machinatrainerbig.map +2 -2
  93. cogames/maps/machinatrainersmall.map +2 -2
  94. cogames/maps/planky_evals/aligner_avoid_aoe.map +28 -0
  95. cogames/maps/planky_evals/aligner_full_cycle.map +28 -0
  96. cogames/maps/planky_evals/aligner_gear.map +24 -0
  97. cogames/maps/planky_evals/aligner_hearts.map +24 -0
  98. cogames/maps/planky_evals/aligner_junction.map +26 -0
  99. cogames/maps/planky_evals/exploration_distant.map +28 -0
  100. cogames/maps/planky_evals/maze.map +32 -0
  101. cogames/maps/planky_evals/miner_best_resource.map +26 -0
  102. cogames/maps/planky_evals/miner_deposit.map +24 -0
  103. cogames/maps/planky_evals/miner_extract.map +26 -0
  104. cogames/maps/planky_evals/miner_full_cycle.map +28 -0
  105. cogames/maps/planky_evals/miner_gear.map +24 -0
  106. cogames/maps/planky_evals/multi_role.map +28 -0
  107. cogames/maps/planky_evals/resource_chain.map +30 -0
  108. cogames/maps/planky_evals/scout_explore.map +32 -0
  109. cogames/maps/planky_evals/scout_gear.map +24 -0
  110. cogames/maps/planky_evals/scrambler_full_cycle.map +28 -0
  111. cogames/maps/planky_evals/scrambler_gear.map +24 -0
  112. cogames/maps/planky_evals/scrambler_target.map +26 -0
  113. cogames/maps/planky_evals/stuck_corridor.map +32 -0
  114. cogames/maps/planky_evals/survive_retreat.map +26 -0
  115. cogames/maps/training_facility_clipped.map +2 -2
  116. cogames/maps/training_facility_open_1.map +2 -2
  117. cogames/maps/training_facility_open_2.map +2 -2
  118. cogames/maps/training_facility_open_3.map +2 -2
  119. cogames/maps/training_facility_tight_4.map +2 -2
  120. cogames/maps/training_facility_tight_5.map +2 -2
  121. cogames/maps/vanilla_large.map +2 -2
  122. cogames/maps/vanilla_small.map +2 -2
  123. cogames/pickup.py +183 -0
  124. cogames/play.py +166 -33
  125. cogames/policy/chaos_monkey.py +54 -0
  126. cogames/policy/nim_agents/__init__.py +27 -10
  127. cogames/policy/nim_agents/agents.py +121 -60
  128. cogames/policy/nim_agents/thinky_eval.py +35 -222
  129. cogames/policy/pufferlib_policy.py +67 -32
  130. cogames/policy/starter_agent.py +184 -0
  131. cogames/policy/trainable_policy_template.py +4 -1
  132. cogames/train.py +51 -13
  133. cogames/verbose.py +2 -2
  134. cogames-0.3.64.dist-info/METADATA +1842 -0
  135. cogames-0.3.64.dist-info/RECORD +159 -0
  136. cogames-0.3.64.dist-info/licenses/LICENSE +21 -0
  137. cogames-0.3.64.dist-info/top_level.txt +2 -0
  138. metta_alo/__init__.py +0 -0
  139. metta_alo/job_specs.py +17 -0
  140. metta_alo/policy.py +16 -0
  141. metta_alo/pure_single_episode_runner.py +75 -0
  142. metta_alo/py.typed +0 -0
  143. metta_alo/rollout.py +322 -0
  144. metta_alo/scoring.py +168 -0
  145. cogames/maps/diagnostic_evals/diagnostic_assembler_near.map +0 -49
  146. cogames/maps/diagnostic_evals/diagnostic_assembler_search.map +0 -49
  147. cogames/maps/diagnostic_evals/diagnostic_assembler_search_hard.map +0 -89
  148. cogames/policy/nim_agents/common.nim +0 -887
  149. cogames/policy/nim_agents/install.sh +0 -1
  150. cogames/policy/nim_agents/ladybug_agent.nim +0 -984
  151. cogames/policy/nim_agents/nim_agents.nim +0 -55
  152. cogames/policy/nim_agents/nim_agents.nims +0 -14
  153. cogames/policy/nim_agents/nimby.lock +0 -3
  154. cogames/policy/nim_agents/racecar_agents.nim +0 -884
  155. cogames/policy/nim_agents/random_agents.nim +0 -68
  156. cogames/policy/nim_agents/test_agents.py +0 -53
  157. cogames/policy/nim_agents/thinky_agents.nim +0 -717
  158. cogames/policy/scripted_agent/baseline_agent.py +0 -1049
  159. cogames/policy/scripted_agent/demo_policy.py +0 -244
  160. cogames/policy/scripted_agent/pathfinding.py +0 -126
  161. cogames/policy/scripted_agent/starter_agent.py +0 -136
  162. cogames/policy/scripted_agent/types.py +0 -235
  163. cogames/policy/scripted_agent/unclipping_agent.py +0 -476
  164. cogames/policy/scripted_agent/utils.py +0 -385
  165. cogames-0.3.49.dist-info/METADATA +0 -406
  166. cogames-0.3.49.dist-info/RECORD +0 -136
  167. cogames-0.3.49.dist-info/top_level.txt +0 -1
  168. {cogames-0.3.49.dist-info → cogames-0.3.64.dist-info}/WHEEL +0 -0
  169. {cogames-0.3.49.dist-info → cogames-0.3.64.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,153 @@
1
+ """Reward preset wiring for the CogsGuard (Cogs vs Clips) mission.
2
+
3
+ The mission has a single "true" objective signal, plus optional shaping variants.
4
+ Reward variants are stackable; each one adds additional shaping signals on top of the
5
+ mission's default objective rewards.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import Literal, Sequence, cast
11
+
12
+ from mettagrid.config.game_value import stat
13
+ from mettagrid.config.mettagrid_config import MettaGridConfig
14
+ from mettagrid.config.reward_config import AgentReward, reward
15
+
16
+ CogsGuardRewardVariant = Literal["credit", "milestones", "no_objective", "penalize_vibe_change", "objective"]
17
+
18
+ AVAILABLE_REWARD_VARIANTS: tuple[CogsGuardRewardVariant, ...] = (
19
+ "objective",
20
+ "no_objective",
21
+ "milestones",
22
+ "credit",
23
+ "penalize_vibe_change",
24
+ )
25
+
26
+ _OBJECTIVE_STAT_KEY = "aligned_junction_held"
27
+
28
+
29
+ def _apply_milestones(rewards: dict[str, AgentReward], *, max_junctions: int = 100) -> None:
30
+ """Add milestone shaping rewards onto an existing baseline.
31
+
32
+ Args:
33
+ rewards: Rewards dict to modify in-place.
34
+ max_junctions: Maximum expected number of junctions for capping rewards.
35
+ Defaults to 100 as a reasonable upper bound for most maps.
36
+ """
37
+ w_junction_aligned = 1.0
38
+ w_scramble_act = 0.5
39
+ w_align_act = 1.0
40
+
41
+ # Max caps based on expected junction counts
42
+ max_junction_aligned = w_junction_aligned * max_junctions
43
+ max_scramble = w_scramble_act * max_junctions
44
+ max_align = w_align_act * max_junctions
45
+
46
+ rewards["aligned_junctions"] = reward(
47
+ stat("collective.junction"),
48
+ weight=w_junction_aligned,
49
+ max=max_junction_aligned,
50
+ )
51
+
52
+ rewards["junction_scrambled_by_agent"] = reward(
53
+ stat("junction.scrambled_by_agent"),
54
+ weight=w_scramble_act,
55
+ max=max_scramble,
56
+ )
57
+ rewards["junction_aligned_by_agent"] = reward(
58
+ stat("junction.aligned_by_agent"),
59
+ weight=w_align_act,
60
+ max=max_align,
61
+ )
62
+
63
+
64
+ def _apply_penalize_vibe_change(rewards: dict[str, AgentReward]) -> None:
65
+ """Add penalty for vibe changes to discourage spamming."""
66
+ w_vibe_change = -0.01
67
+ rewards["vibe_change_penalty"] = reward(stat("action.change_vibe.success"), weight=w_vibe_change)
68
+
69
+
70
+ def _apply_credit(rewards: dict[str, AgentReward]) -> None:
71
+ """Add dense precursor shaping rewards onto an existing baseline."""
72
+ w_heart = 0.05
73
+ cap_heart = 0.5
74
+ w_align_gear = 0.2
75
+ cap_align_gear = 0.4
76
+ w_scramble_gear = 0.2
77
+ cap_scramble_gear = 0.4
78
+ w_element_gain = 0.001
79
+ cap_element_gain = 0.1
80
+
81
+ # Stats rewards for gains as a single map
82
+ gain_rewards: dict[str, AgentReward] = {
83
+ "heart_gained": reward(stat("heart.gained"), weight=w_heart, max=cap_heart),
84
+ "aligner_gained": reward(stat("aligner.gained"), weight=w_align_gear, max=cap_align_gear),
85
+ "scrambler_gained": reward(stat("scrambler.gained"), weight=w_scramble_gear, max=cap_scramble_gear),
86
+ "carbon_gained": reward(stat("carbon.gained"), weight=w_element_gain, max=cap_element_gain),
87
+ "oxygen_gained": reward(stat("oxygen.gained"), weight=w_element_gain, max=cap_element_gain),
88
+ "germanium_gained": reward(stat("germanium.gained"), weight=w_element_gain, max=cap_element_gain),
89
+ "silicon_gained": reward(stat("silicon.gained"), weight=w_element_gain, max=cap_element_gain),
90
+ }
91
+ rewards.update(gain_rewards)
92
+
93
+ # Collective deposit rewards
94
+ w_deposit = 0.002
95
+ cap_deposit = 0.2
96
+ deposit_rewards: dict[str, AgentReward] = {
97
+ f"collective_{element}_deposited": reward(
98
+ stat(f"collective.{element}.deposited"), weight=w_deposit, max=cap_deposit
99
+ )
100
+ for element in ["carbon", "oxygen", "germanium", "silicon"]
101
+ }
102
+ rewards.update(deposit_rewards)
103
+
104
+
105
+ def apply_reward_variants(env: MettaGridConfig, *, variants: str | Sequence[str] | None = None) -> None:
106
+ """Apply CogsGuard reward variants to `env`.
107
+
108
+ Variants are stackable:
109
+ - `objective`: no-op marker; keeps the mission's default objective reward wiring.
110
+ - `no_objective`: disables the objective stat reward (`junction.held`).
111
+ - `milestones`: adds shaped rewards for aligning/scrambling junctions and holding more junctions.
112
+ - `credit`: adds additional dense shaping for precursor behaviors (resources/gear/deposits).
113
+ - `penalize_vibe_change`: adds a penalty for vibe changes to discourage spamming.
114
+ """
115
+ if not variants:
116
+ return
117
+
118
+ variant_names = [variants] if isinstance(variants, str) else list(variants)
119
+
120
+ reward_variants: list[CogsGuardRewardVariant] = []
121
+ for variant_name in variant_names:
122
+ if variant_name not in AVAILABLE_REWARD_VARIANTS:
123
+ available = ", ".join(AVAILABLE_REWARD_VARIANTS)
124
+ raise ValueError(f"Unknown Cogsguard reward variant '{variant_name}'. Available: {available}")
125
+ variant = cast(CogsGuardRewardVariant, variant_name)
126
+ if variant in reward_variants:
127
+ continue
128
+ reward_variants.append(variant)
129
+
130
+ enabled = set(reward_variants)
131
+ if enabled <= {"objective"}:
132
+ return
133
+
134
+ # Start from the mission's existing objective baseline to preserve its scaling.
135
+ rewards = dict(env.game.agent.rewards)
136
+
137
+ if "no_objective" in enabled:
138
+ rewards.pop(_OBJECTIVE_STAT_KEY, None)
139
+ if "milestones" in enabled:
140
+ _apply_milestones(rewards)
141
+ if "credit" in enabled:
142
+ _apply_credit(rewards)
143
+ if "penalize_vibe_change" in enabled:
144
+ _apply_penalize_vibe_change(rewards)
145
+
146
+ env.game.agent.rewards = rewards
147
+
148
+ # Deterministic label suffix order (exclude "objective").
149
+ for variant in AVAILABLE_REWARD_VARIANTS:
150
+ if variant == "objective":
151
+ continue
152
+ if variant in enabled:
153
+ env.label += f".{variant}"
@@ -0,0 +1,56 @@
1
+ """CogsGuard tutorial mission configuration."""
2
+
3
+ from cogames.cogs_vs_clips.mission import Mission, Site
4
+ from cogames.cogs_vs_clips.procedural import MachinaArena
5
+ from mettagrid.mapgen.mapgen import MapGen
6
+ from mettagrid.mapgen.scenes.base_hub import BaseHubConfig
7
+
8
+
9
+ def make_cogsguard_tutorial_site() -> Site:
10
+ """Create a smaller, simpler CogsGuard arena for the tutorial."""
11
+ hub_config = BaseHubConfig(
12
+ corner_bundle="extractors",
13
+ cross_bundle="none",
14
+ cross_distance=5,
15
+ hub_width=15,
16
+ hub_height=15,
17
+ outer_clearance=2,
18
+ stations=[
19
+ "aligner_station",
20
+ "scrambler_station",
21
+ "miner_station",
22
+ "scout_station",
23
+ "chest",
24
+ ],
25
+ )
26
+ map_builder = MapGen.Config(
27
+ width=35,
28
+ height=35,
29
+ instance=MachinaArena.Config(
30
+ spawn_count=1,
31
+ building_coverage=0.05,
32
+ hub=hub_config,
33
+ ),
34
+ )
35
+ return Site(
36
+ name="cogsguard_tutorial",
37
+ description="CogsGuard tutorial arena - small map for learning",
38
+ map_builder=map_builder,
39
+ min_cogs=1,
40
+ max_cogs=1,
41
+ )
42
+
43
+
44
+ CogsGuardTutorialMission = Mission(
45
+ name="tutorial",
46
+ description="Learn the basics of CogsGuard: Roles, Resources, and Territory Control.",
47
+ site=make_cogsguard_tutorial_site(),
48
+ num_cogs=1,
49
+ max_steps=2000,
50
+ # Generous initial resources for learning
51
+ collective_initial_carbon=50,
52
+ collective_initial_oxygen=50,
53
+ collective_initial_germanium=50,
54
+ collective_initial_silicon=50,
55
+ collective_initial_heart=10,
56
+ )
@@ -19,9 +19,8 @@ Diagnostic missions test specific skills in isolation with controlled, repeatabl
19
19
  #### Navigation & Delivery
20
20
 
21
21
  - `diagnostic_chest_navigation1/2/3` - Navigate to chest and deposit hearts (varying difficulty)
22
- - `diagnostic_chest_near` - Chest nearby, test deposit mechanics
23
- - `diagnostic_chest_search` - Find chest through exploration
24
- - `diagnostic_chest_deposit_near/search` - Combined navigation and deposit tests
22
+ - `diagnostic_chest_deposit_near` - Chest nearby, test deposit mechanics
23
+ - `diagnostic_chest_deposit_search` - Find chest through exploration
25
24
 
26
25
  #### Resource Extraction
27
26
 
@@ -32,18 +31,13 @@ Diagnostic missions test specific skills in isolation with controlled, repeatabl
32
31
 
33
32
  #### Assembly
34
33
 
35
- - `diagnostic_assembler_near` - Assemble hearts at nearby assembler
36
- - `diagnostic_assembler_search` - Find assembler and craft hearts
34
+ - `diagnostic_assemble_seeded_near` - Agents pre-seeded with resources, assemble hearts at nearby hub
35
+ - `diagnostic_assemble_seeded_search` - Agents pre-seeded, find hub and craft hearts
37
36
 
38
37
  #### Energy Management
39
38
 
40
39
  - `diagnostic_charge_up` - Test charging mechanics and energy management
41
40
 
42
- #### Unclipping
43
-
44
- - `diagnostic_unclip_craft` - Craft unclip items to restore clipped extractors
45
- - `diagnostic_unclip_preseed` - Unclip with pre-seeded inventory
46
-
47
41
  #### Complex Scenarios
48
42
 
49
43
  - `diagnostic_radial` - Radial resource layout with chorus assembly
@@ -68,7 +62,7 @@ uv run cogames play --mission evals.diagnostic_extract_missing_oxygen --cogs 2
68
62
  uv run cogames play --mission evals.diagnostic_radial_hard --cogs 1
69
63
 
70
64
  # With policy
71
- uv run cogames play --mission evals.diagnostic_unclip_craft -p scripted_baseline --cogs 1
65
+ uv run cogames play --mission evals.diagnostic_radial -p baseline --cogs 1
72
66
  ```
73
67
 
74
68
  ---
@@ -100,7 +94,7 @@ uv run cogames play --mission hello_world.oxygen_bottleneck --cogs 2
100
94
 
101
95
  #### energy_starved
102
96
 
103
- **Challenge:** Low energy regen and weak chargers require careful energy management.
97
+ **Challenge:** Low energy regen and weak junctions require careful energy management.
104
98
 
105
99
  **Variants Applied:**
106
100
 
@@ -192,7 +186,7 @@ uv run cogames play --mission hello_world.oxygen_bottleneck --cogs 2 --variant c
192
186
  uv run cogames play --mission hello_world.energy_starved --cogs 2 --variant compass --variant small_50
193
187
 
194
188
  # With policy
195
- uv run cogames play --mission hello_world.single_use_swarm --cogs 4 -p scripted_baseline
189
+ uv run cogames play --mission hello_world.single_use_swarm --cogs 4 -p baseline
196
190
  ```
197
191
 
198
192
  ---
@@ -206,16 +200,16 @@ For systematic evaluation across multiple missions and configurations:
206
200
  ```bash
207
201
  # Evaluate on integrated eval suite
208
202
  uv run python packages/cogames/scripts/run_evaluation.py \
209
- --agent cogames.policy.nim_agents.agents.ThinkyAgentsMultiPolicy \
203
+ --policy thinky \
210
204
  --mission-set integrated_evals \
211
205
  --cogs 4 \
212
206
  --repeats 2
213
207
 
214
208
  # Evaluate specific agent
215
209
  uv run python packages/cogames/scripts/run_evaluation.py \
216
- --agent simple \
210
+ --policy baseline \
217
211
  --steps 1000 \
218
- --output eval_simple.json
212
+ --output eval_baseline.json
219
213
  ```
220
214
 
221
215
  ### Using in Curriculum Training
@@ -0,0 +1,81 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ from cogames.cogs_vs_clips.mission import CogsGuardMission, Site
6
+ from cogames.cogs_vs_clips.mission_utils import get_map
7
+
8
+ MAPS_DIR = Path(__file__).resolve().parent.parent.parent / "maps"
9
+
10
+ COGSGUARD_EVALS_BASE = Site(
11
+ name="cogsguard_evals",
12
+ description="CogsGuard evaluation arenas.",
13
+ map_builder=get_map("evals/eval_balanced_spread.map"),
14
+ min_cogs=1,
15
+ max_cogs=20,
16
+ )
17
+
18
+
19
+ def _count_spawn_pads(map_path: Path) -> int:
20
+ text = map_path.read_text()
21
+ if "map_data:" not in text:
22
+ raise ValueError(f"Missing map_data block in {map_path}")
23
+ map_section = text.split("map_data:", 1)[1].split("char_to_map_name:", 1)[0]
24
+ count = map_section.count("@")
25
+ if count <= 0:
26
+ raise ValueError(f"No spawn pads found in {map_path}")
27
+ return count
28
+
29
+
30
+ def _make_eval_site(map_name: str, num_cogs: int) -> Site:
31
+ site = COGSGUARD_EVALS_BASE.model_copy(
32
+ update={
33
+ "map_builder": get_map(map_name),
34
+ "min_cogs": num_cogs,
35
+ "max_cogs": num_cogs,
36
+ }
37
+ )
38
+ return site
39
+
40
+
41
+ def _description_from_stem(stem: str) -> str:
42
+ display = stem
43
+ if display.startswith("eval_"):
44
+ display = display[len("eval_") :]
45
+ display = display.replace("_", " ")
46
+ return f"CogsGuard eval: {display}."
47
+
48
+
49
+ COGSGUARD_EVAL_MAPS: list[str] = [
50
+ "evals/eval_balanced_spread.map",
51
+ "evals/eval_clip_oxygen.map",
52
+ "evals/eval_collect_resources.map",
53
+ "evals/eval_collect_resources_medium.map",
54
+ "evals/eval_collect_resources_hard.map",
55
+ "evals/eval_divide_and_conquer.map",
56
+ "evals/eval_energy_starved.map",
57
+ "evals/eval_multi_coordinated_collect_hard.map",
58
+ "evals/eval_oxygen_bottleneck.map",
59
+ "evals/eval_single_use_world.map",
60
+ "evals/extractor_hub_30x30.map",
61
+ "evals/extractor_hub_50x50.map",
62
+ "evals/extractor_hub_70x70.map",
63
+ "evals/extractor_hub_80x80.map",
64
+ "evals/extractor_hub_100x100.map",
65
+ ]
66
+
67
+ COGSGUARD_EVAL_COGS = {map_name: _count_spawn_pads(MAPS_DIR / map_name) for map_name in COGSGUARD_EVAL_MAPS}
68
+
69
+ COGSGUARD_EVAL_MISSIONS: list[CogsGuardMission] = []
70
+ for map_name in COGSGUARD_EVAL_MAPS:
71
+ stem = Path(map_name).stem
72
+ num_cogs = COGSGUARD_EVAL_COGS[map_name]
73
+ site = _make_eval_site(map_name, num_cogs)
74
+ COGSGUARD_EVAL_MISSIONS.append(
75
+ CogsGuardMission(
76
+ name=stem,
77
+ description=_description_from_stem(stem),
78
+ site=site,
79
+ num_cogs=num_cogs,
80
+ )
81
+ )