cogames-agents 0.0.0.10__tar.gz → 0.0.2__tar.gz
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.
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/MANIFEST.in +0 -2
- cogames_agents-0.0.2/PKG-INFO +66 -0
- cogames_agents-0.0.2/README.md +47 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/pyproject.toml +5 -23
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/setup.py +26 -34
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/teacher.py → cogames_agents-0.0.2/src/cogames_agents/policy/cogsguard_teacher.py +2 -3
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/__init__.py +2 -2
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/agents.py +7 -12
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/cogsguard_agents.nim +6 -121
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/common.nim +19 -168
- cogames_agents-0.0.2/src/cogames_agents/policy/nim_agents/ladybug_agent.nim +984 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/nim_agents.nim +7 -8
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/racecar_agents.nim +87 -47
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/test_agents.py +1 -1
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/thinky_agents.nim +72 -32
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/thinky_eval.py +13 -11
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/baseline_agent.py +62 -54
- cogames_agents-0.0.2/src/cogames_agents/policy/scripted_agent/cogsguard/__init__.py +5 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/aligner.py +83 -133
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/debug_agent.py +39 -36
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/miner.py +42 -82
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/policy.py +179 -907
- cogames_agents-0.0.2/src/cogames_agents/policy/scripted_agent/cogsguard/scout.py +152 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/scrambler.py +92 -139
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/types.py +57 -69
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/demo_policy.py +26 -23
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/types.py +12 -12
- cogames_agents-0.0.2/src/cogames_agents/policy/scripted_agent/unclipping_agent.py +468 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/utils.py +51 -18
- cogames_agents-0.0.2/src/cogames_agents/policy/scripted_registry.py +28 -0
- cogames_agents-0.0.2/src/cogames_agents.egg-info/PKG-INFO +66 -0
- cogames_agents-0.0.2/src/cogames_agents.egg-info/SOURCES.txt +46 -0
- cogames_agents-0.0.2/src/cogames_agents.egg-info/requires.txt +3 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/tests/test_cogsguard_roles.py +7 -15
- cogames_agents-0.0.2/tests/test_scripted_registry.py +19 -0
- cogames_agents-0.0.0.10/.gitignore +0 -2
- cogames_agents-0.0.0.10/.nim-version +0 -1
- cogames_agents-0.0.0.10/.nimby-version +0 -1
- cogames_agents-0.0.0.10/PKG-INFO +0 -85
- cogames_agents-0.0.0.10/README.co-gas.md +0 -47
- cogames_agents-0.0.0.10/README.md +0 -63
- cogames_agents-0.0.0.10/docs/0018-tribal-village-temple-roles.md +0 -130
- cogames_agents-0.0.0.10/docs/aligned_junction_held_investigation.md +0 -466
- cogames_agents-0.0.0.10/docs/app-backend-eval-pipeline.md +0 -68
- cogames_agents-0.0.0.10/docs/aws-sso-on-mettabox.md +0 -98
- cogames_agents-0.0.0.10/docs/beta-cvc-policy-validation.md +0 -126
- cogames_agents-0.0.0.10/docs/cogames-eval-internals.md +0 -210
- cogames_agents-0.0.0.10/docs/cogas-agent-design.md +0 -374
- cogames_agents-0.0.0.10/docs/cogsguard-mechanics-deep-dive.md +0 -458
- cogames_agents-0.0.0.10/docs/creating-scripted-agents.md +0 -539
- cogames_agents-0.0.0.10/docs/eval-results-log.md +0 -149
- cogames_agents-0.0.0.10/docs/evolution-system-architecture.md +0 -367
- cogames_agents-0.0.0.10/docs/leaderboard-submission-process.md +0 -430
- cogames_agents-0.0.0.10/docs/machina1-agent-analysis.md +0 -345
- cogames_agents-0.0.0.10/docs/metta-cogames-overview.md +0 -346
- cogames_agents-0.0.0.10/docs/mettaboxes.md +0 -226
- cogames_agents-0.0.0.10/docs/nim-vs-python-agents-comparison.md +0 -197
- cogames_agents-0.0.0.10/docs/role-distribution-analysis.md +0 -376
- cogames_agents-0.0.0.10/docs/scripted-agent-registry.md +0 -38
- cogames_agents-0.0.0.10/docs/training-and-submission-guide.md +0 -501
- cogames_agents-0.0.0.10/docs/wandb-analysis-cogsguard-training.md +0 -189
- cogames_agents-0.0.0.10/scripts/README.md +0 -104
- cogames_agents-0.0.0.10/scripts/benchmark_agents.sh +0 -150
- cogames_agents-0.0.0.10/scripts/ci_eval.sh +0 -225
- cogames_agents-0.0.0.10/scripts/compare_agents.py +0 -169
- cogames_agents-0.0.0.10/scripts/enrich_eval_output.py +0 -237
- cogames_agents-0.0.0.10/scripts/eval_cogas.sh +0 -177
- cogames_agents-0.0.0.10/scripts/quick_eval.sh +0 -93
- cogames_agents-0.0.0.10/scripts/regression_check.py +0 -260
- cogames_agents-0.0.0.10/scripts/run_cogsguard_instrumented_audit.py +0 -215
- cogames_agents-0.0.0.10/scripts/run_cogsguard_parity.py +0 -158
- cogames_agents-0.0.0.10/scripts/run_cogsguard_rollout.py +0 -560
- cogames_agents-0.0.0.10/scripts/tune_cogas.sh +0 -194
- cogames_agents-0.0.0.10/src/cogames_agents/evals/__init__.py +0 -5
- cogames_agents-0.0.0.10/src/cogames_agents/evals/planky_evals.py +0 -424
- cogames_agents-0.0.0.10/src/cogames_agents/policy/evolution/cogsguard/__init__.py +0 -0
- cogames_agents-0.0.0.10/src/cogames_agents/policy/evolution/cogsguard/evolution.py +0 -695
- cogames_agents-0.0.0.10/src/cogames_agents/policy/evolution/cogsguard/evolutionary_coordinator.py +0 -540
- cogames_agents-0.0.0.10/src/cogames_agents/policy/nim_agents/cogsguard_align_all_agents.nim +0 -569
- cogames_agents-0.0.0.10/src/cogames_agents/policy/nim_agents/install.sh +0 -1
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/README.md +0 -360
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/__init__.py +0 -0
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/__init__.py +0 -5
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/context.py +0 -67
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/entity_map.py +0 -157
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goal.py +0 -107
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/__init__.py +0 -27
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/aligner.py +0 -222
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/gear.py +0 -181
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/miner.py +0 -407
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/scout.py +0 -40
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/scrambler.py +0 -218
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/shared.py +0 -180
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/stem.py +0 -49
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/goals/survive.py +0 -96
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/navigator.py +0 -388
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/obs_parser.py +0 -339
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/policy.py +0 -470
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/buggy/trace.py +0 -69
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/__init__.py +0 -5
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/context.py +0 -68
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/entity_map.py +0 -152
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goal.py +0 -115
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/__init__.py +0 -27
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/aligner.py +0 -160
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/gear.py +0 -197
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/miner.py +0 -441
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/scout.py +0 -40
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/scrambler.py +0 -174
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/shared.py +0 -160
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/stem.py +0 -60
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/goals/survive.py +0 -100
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/navigator.py +0 -401
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/obs_parser.py +0 -293
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/policy.py +0 -525
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogas/trace.py +0 -69
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/CLAUDE.md +0 -517
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/README.md +0 -252
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/__init__.py +0 -74
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/aligned_junction_held_investigation.md +0 -152
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/behavior_hooks.py +0 -44
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/control_agent.py +0 -323
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/parity_metrics.py +0 -36
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/prereq_trace.py +0 -33
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/role_trace.py +0 -50
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/rollout_trace.py +0 -40
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/scout.py +0 -69
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/targeted_agent.py +0 -418
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/v2_agent.py +0 -49
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/common/__init__.py +0 -0
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/common/geometry.py +0 -24
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/common/roles.py +0 -34
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/common/tag_utils.py +0 -48
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/CLAUDE.md +0 -139
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/IMPROVEMENTS.md +0 -160
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/NOTES.md +0 -153
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/PLAN.md +0 -254
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/README.md +0 -189
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/STRATEGY.md +0 -100
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/__init__.py +0 -5
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/context.py +0 -68
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/entity_map.py +0 -152
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goal.py +0 -109
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/__init__.py +0 -27
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/aligner.py +0 -160
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/gear.py +0 -185
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/miner.py +0 -486
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/scout.py +0 -40
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/scrambler.py +0 -174
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/shared.py +0 -275
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/stem.py +0 -49
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/goals/survive.py +0 -86
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/navigator.py +0 -388
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/obs_parser.py +0 -293
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/policy.py +0 -1056
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/__init__.py +0 -0
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/conftest.py +0 -66
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/helpers.py +0 -159
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/test_aligner.py +0 -24
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/test_miner.py +0 -30
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/test_scout.py +0 -15
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/test_scrambler.py +0 -29
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/tests/test_stem.py +0 -36
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/planky/trace.py +0 -69
- cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_registry.py +0 -80
- cogames_agents-0.0.0.10/src/cogames_agents.egg-info/PKG-INFO +0 -85
- cogames_agents-0.0.0.10/src/cogames_agents.egg-info/SOURCES.txt +0 -189
- cogames_agents-0.0.0.10/src/cogames_agents.egg-info/requires.txt +0 -8
- cogames_agents-0.0.0.10/tests/conftest.py +0 -119
- cogames_agents-0.0.0.10/tests/test_agent_benchmarks.py +0 -210
- cogames_agents-0.0.0.10/tests/test_cogsguard_action_timing.py +0 -53
- cogames_agents-0.0.0.10/tests/test_cogsguard_miner_danger_radius.py +0 -67
- cogames_agents-0.0.0.10/tests/test_eval_metrics.py +0 -324
- cogames_agents-0.0.0.10/tests/test_evolution.py +0 -492
- cogames_agents-0.0.0.10/tests/test_evolution_integration.py +0 -319
- cogames_agents-0.0.0.10/tests/test_evolutionary_coordinator.py +0 -296
- cogames_agents-0.0.0.10/tests/test_parity_metrics.py +0 -36
- cogames_agents-0.0.0.10/tests/test_planky_behaviors.py +0 -553
- cogames_agents-0.0.0.10/tests/test_prereq_trace.py +0 -37
- cogames_agents-0.0.0.10/tests/test_role_distributions.py +0 -205
- cogames_agents-0.0.0.10/tests/test_role_trace.py +0 -53
- cogames_agents-0.0.0.10/tests/test_rollout_trace.py +0 -32
- cogames_agents-0.0.0.10/tests/test_scripted_agent_tags.py +0 -23
- cogames_agents-0.0.0.10/tests/test_scripted_agent_type_tags.py +0 -19
- cogames_agents-0.0.0.10/tests/test_scripted_policies.py +0 -149
- cogames_agents-0.0.0.10/tests/test_scripted_registry.py +0 -35
- cogames_agents-0.0.0.10/tutorials/cogsguard_make_policy.ipynb +0 -204
- cogames_agents-0.0.0.10/tutorials/cogsguard_make_policy.md +0 -96
- cogames_agents-0.0.0.10/tutorials/cogsguard_make_policy.py +0 -135
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/setup.cfg +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/__init__.py +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/__init__.py +0 -0
- /cogames_agents-0.0.0.10/src/cogames_agents/policy/scripted_agent/cogsguard/roles.py → /cogames_agents-0.0.2/src/cogames_agents/policy/cogsguard_roles.py +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/nim_agents.nims +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/nimby.lock +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/random_agents.nim +0 -0
- {cogames_agents-0.0.0.10/src/cogames_agents/policy/evolution → cogames_agents-0.0.2/src/cogames_agents/policy/scripted_agent}/__init__.py +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/cogsguard/options.py +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/scripted_agent/pathfinding.py +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/py.typed +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents.egg-info/dependency_links.txt +0 -0
- {cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents.egg-info/top_level.txt +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Include Nim source files for building from source distribution
|
|
2
2
|
recursive-include src/cogames_agents/policy/nim_agents *.nim *.nims
|
|
3
3
|
include src/cogames_agents/policy/nim_agents/nimby.lock
|
|
4
|
-
include .nim-version
|
|
5
|
-
include .nimby-version
|
|
6
4
|
|
|
7
5
|
# Exclude build artifacts
|
|
8
6
|
prune src/cogames_agents/policy/nim_agents/nimbledeps
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cogames-agents
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Optional agent policies for CoGames
|
|
5
|
+
Author: Metta AI
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Metta-AI/metta/tree/main/packages/cogames-agents
|
|
8
|
+
Project-URL: Repository, https://github.com/Metta-AI/metta
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Requires-Python: <3.13,>=3.12
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: cogames>=0.0.1
|
|
17
|
+
Requires-Dist: mettagrid==0.2.0.58
|
|
18
|
+
Requires-Dist: numpy>=2.0.0
|
|
19
|
+
|
|
20
|
+
# cogames-agents
|
|
21
|
+
|
|
22
|
+
Optional scripted policies for CoGames. Use them for quick baselines, play/eval smoke tests, or as teacher policies.
|
|
23
|
+
|
|
24
|
+
## Scripted policy registry
|
|
25
|
+
|
|
26
|
+
The registry at `cogames_agents.policy.scripted_registry` maps short names to `metta://policy/...` URIs. Scripted agents
|
|
27
|
+
and teachers share these identifiers, so the same name works for evaluation, play, and `TeacherConfig.policy_uri`.
|
|
28
|
+
|
|
29
|
+
Available scripted policy names:
|
|
30
|
+
|
|
31
|
+
- `baseline`
|
|
32
|
+
- `ladybug`
|
|
33
|
+
- `thinky`
|
|
34
|
+
- `race_car`
|
|
35
|
+
- `nim_random`
|
|
36
|
+
- `cogsguard`
|
|
37
|
+
- `cogsguard_py`
|
|
38
|
+
- `teacher`
|
|
39
|
+
- `miner`
|
|
40
|
+
- `scout`
|
|
41
|
+
- `aligner`
|
|
42
|
+
- `scrambler`
|
|
43
|
+
|
|
44
|
+
Role-specific policies are exposed via role names (miner/scout/aligner/scrambler). For the teacher policy, you can pass
|
|
45
|
+
`role_vibes` as a comma-separated list:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
metta://policy/teacher?role_vibes=miner,scout
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Recipe usage
|
|
52
|
+
|
|
53
|
+
The `recipes.experiment.scripted_agents` recipe accepts the same scripted policy names:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
./tools/run.py recipes.experiment.scripted_agents.play agent=thinky suite=cvc_arena
|
|
57
|
+
./tools/run.py recipes.experiment.scripted_agents.play agent=miner suite=cogsguard
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Included policies
|
|
61
|
+
|
|
62
|
+
- Nim policies (short names; default when both exist): `thinky`, `nim_random`, `race_car`, `ladybug`, `cogsguard`
|
|
63
|
+
- Python scripted policies (use `_py` only when Nim exists): `baseline`, `tiny_baseline`, `ladybug_py`, `cogsguard_py`
|
|
64
|
+
- Core scripted policy (in `cogames`): `starter`
|
|
65
|
+
- Scripted roles: `miner`, `scout`, `aligner`, `scrambler`
|
|
66
|
+
- Teacher wrapper: `teacher` (forces an initial role/vibe, then delegates to the Nim policy)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# cogames-agents
|
|
2
|
+
|
|
3
|
+
Optional scripted policies for CoGames. Use them for quick baselines, play/eval smoke tests, or as teacher policies.
|
|
4
|
+
|
|
5
|
+
## Scripted policy registry
|
|
6
|
+
|
|
7
|
+
The registry at `cogames_agents.policy.scripted_registry` maps short names to `metta://policy/...` URIs. Scripted agents
|
|
8
|
+
and teachers share these identifiers, so the same name works for evaluation, play, and `TeacherConfig.policy_uri`.
|
|
9
|
+
|
|
10
|
+
Available scripted policy names:
|
|
11
|
+
|
|
12
|
+
- `baseline`
|
|
13
|
+
- `ladybug`
|
|
14
|
+
- `thinky`
|
|
15
|
+
- `race_car`
|
|
16
|
+
- `nim_random`
|
|
17
|
+
- `cogsguard`
|
|
18
|
+
- `cogsguard_py`
|
|
19
|
+
- `teacher`
|
|
20
|
+
- `miner`
|
|
21
|
+
- `scout`
|
|
22
|
+
- `aligner`
|
|
23
|
+
- `scrambler`
|
|
24
|
+
|
|
25
|
+
Role-specific policies are exposed via role names (miner/scout/aligner/scrambler). For the teacher policy, you can pass
|
|
26
|
+
`role_vibes` as a comma-separated list:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
metta://policy/teacher?role_vibes=miner,scout
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Recipe usage
|
|
33
|
+
|
|
34
|
+
The `recipes.experiment.scripted_agents` recipe accepts the same scripted policy names:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
./tools/run.py recipes.experiment.scripted_agents.play agent=thinky suite=cvc_arena
|
|
38
|
+
./tools/run.py recipes.experiment.scripted_agents.play agent=miner suite=cogsguard
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Included policies
|
|
42
|
+
|
|
43
|
+
- Nim policies (short names; default when both exist): `thinky`, `nim_random`, `race_car`, `ladybug`, `cogsguard`
|
|
44
|
+
- Python scripted policies (use `_py` only when Nim exists): `baseline`, `tiny_baseline`, `ladybug_py`, `cogsguard_py`
|
|
45
|
+
- Core scripted policy (in `cogames`): `starter`
|
|
46
|
+
- Scripted roles: `miner`, `scout`, `aligner`, `scrambler`
|
|
47
|
+
- Teacher wrapper: `teacher` (forces an initial role/vibe, then delegates to the Nim policy)
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools==80.9.0", "wheel==0.45.1"
|
|
2
|
+
requires = ["setuptools==80.9.0", "wheel==0.45.1"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cogames-agents"
|
|
7
|
+
version = "0.0.2"
|
|
7
8
|
description = "Optional agent policies for CoGames"
|
|
8
|
-
dynamic = ["version"]
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12,<3.13"
|
|
11
|
-
license = "MIT"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
12
|
authors = [{ name = "Metta AI" }]
|
|
13
13
|
classifiers = [
|
|
14
14
|
"Programming Language :: Python :: 3",
|
|
15
15
|
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
16
17
|
"Operating System :: POSIX :: Linux",
|
|
17
18
|
"Operating System :: MacOS",
|
|
18
19
|
]
|
|
19
20
|
urls = { Homepage = "https://github.com/Metta-AI/metta/tree/main/packages/cogames-agents", Repository = "https://github.com/Metta-AI/metta" }
|
|
20
|
-
dependencies = ["cogames
|
|
21
|
-
|
|
22
|
-
[project.optional-dependencies]
|
|
23
|
-
test = ["pytest", "pytest-xdist", "ruff"]
|
|
21
|
+
dependencies = ["cogames>=0.0.1", "mettagrid==0.2.0.58", "numpy>=2.0.0"]
|
|
24
22
|
|
|
25
23
|
[tool.setuptools.packages.find]
|
|
26
24
|
where = ["src"]
|
|
@@ -43,22 +41,6 @@ include-package-data = true
|
|
|
43
41
|
"policy/nim_agents/bindings/generated/*.py",
|
|
44
42
|
]
|
|
45
43
|
|
|
46
|
-
[tool.setuptools_scm]
|
|
47
|
-
tag_regex = "^cogames-agents-v(?P<version>\\d+\\.\\d+\\.\\d+(?:\\.\\d+)?)$"
|
|
48
|
-
version_scheme = "no-guess-dev"
|
|
49
|
-
local_scheme = "no-local-version"
|
|
50
|
-
root = "../.."
|
|
51
|
-
fallback_version = "0.0.0"
|
|
52
|
-
git_describe_command = [
|
|
53
|
-
"git",
|
|
54
|
-
"describe",
|
|
55
|
-
"--dirty",
|
|
56
|
-
"--tags",
|
|
57
|
-
"--long",
|
|
58
|
-
"--match",
|
|
59
|
-
"cogames-agents-v*",
|
|
60
|
-
]
|
|
61
|
-
|
|
62
44
|
[tool.uv]
|
|
63
45
|
cache-keys = [
|
|
64
46
|
{ file = "src/cogames_agents/policy/nim_agents/nim_agents.nim" },
|
|
@@ -20,16 +20,8 @@ from setuptools.dist import Distribution
|
|
|
20
20
|
NIM_AGENTS_DIR = Path(__file__).parent / "src" / "cogames_agents" / "policy" / "nim_agents"
|
|
21
21
|
NIMBY_LOCK = NIM_AGENTS_DIR / "nimby.lock"
|
|
22
22
|
BINDINGS_DIR = NIM_AGENTS_DIR / "bindings" / "generated"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _read_dotfile_version(path: Path) -> str:
|
|
28
|
-
return path.read_text().strip()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
NIM_VERSION = _read_dotfile_version(_PKG_ROOT / ".nim-version")
|
|
32
|
-
NIMBY_VERSION = _read_dotfile_version(_PKG_ROOT / ".nimby-version")
|
|
23
|
+
REQUIRED_NIM_VERSION = os.environ.get("COGAMES_NIM_VERSION", "2.2.6")
|
|
24
|
+
NIMBY_VERSION = os.environ.get("COGAMES_NIMBY_VERSION", "0.1.13")
|
|
33
25
|
|
|
34
26
|
|
|
35
27
|
def _get_nimby_url() -> str | None:
|
|
@@ -39,53 +31,53 @@ def _get_nimby_url() -> str | None:
|
|
|
39
31
|
|
|
40
32
|
if system == "Linux" and arch == "x86_64":
|
|
41
33
|
return f"https://github.com/treeform/nimby/releases/download/{NIMBY_VERSION}/nimby-Linux-X64"
|
|
42
|
-
elif system == "Linux" and arch == "aarch64":
|
|
43
|
-
return f"https://github.com/treeform/nimby/releases/download/{NIMBY_VERSION}/nimby-Linux-ARM64"
|
|
44
34
|
elif system == "Darwin" and arch == "arm64":
|
|
45
35
|
return f"https://github.com/treeform/nimby/releases/download/{NIMBY_VERSION}/nimby-macOS-ARM64"
|
|
46
36
|
elif system == "Darwin" and arch == "x86_64":
|
|
47
37
|
return f"https://github.com/treeform/nimby/releases/download/{NIMBY_VERSION}/nimby-macOS-X64"
|
|
48
38
|
else:
|
|
39
|
+
# For unsupported platforms (e.g., Linux ARM64), nimby must be pre-installed
|
|
49
40
|
return None
|
|
50
41
|
|
|
51
42
|
|
|
52
|
-
def _nim_already_installed() -> bool:
|
|
53
|
-
nim = shutil.which("nim")
|
|
54
|
-
if nim is None:
|
|
55
|
-
return False
|
|
56
|
-
result = subprocess.run([nim, "--version"], capture_output=True, text=True)
|
|
57
|
-
return f"Nim Compiler Version {NIM_VERSION}" in result.stdout
|
|
58
|
-
|
|
59
|
-
|
|
60
43
|
def _build_nim() -> None:
|
|
61
44
|
system = platform.system()
|
|
62
45
|
arch = platform.machine()
|
|
63
46
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
nimby_url = _get_nimby_url()
|
|
48
|
+
nim_bin_dir = Path.home() / ".nimby" / "nim" / "bin"
|
|
49
|
+
|
|
50
|
+
if nimby_url is not None:
|
|
51
|
+
# Download and install nimby
|
|
68
52
|
dst = nim_bin_dir / "nimby"
|
|
69
53
|
with tempfile.TemporaryDirectory() as tmp:
|
|
70
54
|
nimby = Path(tmp) / "nimby"
|
|
71
55
|
urllib.request.urlretrieve(nimby_url, nimby)
|
|
72
56
|
nimby.chmod(nimby.stat().st_mode | stat.S_IEXEC)
|
|
73
|
-
subprocess.check_call([str(nimby), "use",
|
|
57
|
+
subprocess.check_call([str(nimby), "use", REQUIRED_NIM_VERSION])
|
|
74
58
|
|
|
75
59
|
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
76
60
|
shutil.copy2(nimby, dst)
|
|
77
61
|
|
|
78
62
|
os.environ["PATH"] = f"{dst.parent}{os.pathsep}" + os.environ.get("PATH", "")
|
|
79
|
-
os.environ["PATH"] = f"{nim_bin_dir}{os.pathsep}" + os.environ.get("PATH", "")
|
|
80
63
|
else:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
64
|
+
# For unsupported platforms, assume nim/nimby are pre-installed
|
|
65
|
+
if shutil.which("nim") is None:
|
|
66
|
+
raise RuntimeError(
|
|
67
|
+
f"Nim is not installed and nimby download is not available for {system} {arch}. "
|
|
68
|
+
"Please install Nim manually (https://nim-lang.org/install.html) or build nimby from source."
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Ensure nim/nimble binaries installed by nimby are discoverable by subprocesses.
|
|
72
|
+
os.environ["PATH"] = f"{nim_bin_dir}{os.pathsep}" + os.environ.get("PATH", "")
|
|
73
|
+
|
|
74
|
+
# Sync Nim dependencies
|
|
75
|
+
if NIMBY_LOCK.exists():
|
|
76
|
+
if shutil.which("nimby") is not None:
|
|
77
|
+
subprocess.check_call(["nimby", "sync", "-g", str(NIMBY_LOCK)], cwd=NIM_AGENTS_DIR)
|
|
78
|
+
else:
|
|
79
|
+
# nimby not available (unsupported platform with manual Nim install) - use nimble directly
|
|
80
|
+
subprocess.check_call(["nimble", "install", "-y"], cwd=NIM_AGENTS_DIR)
|
|
89
81
|
|
|
90
82
|
# Create output directory for compiled binaries
|
|
91
83
|
BINDINGS_DIR.mkdir(parents=True, exist_ok=True)
|
|
@@ -6,12 +6,11 @@ import numpy as np
|
|
|
6
6
|
|
|
7
7
|
from cogames_agents.policy.nim_agents.agents import CogsguardAgentsMultiPolicy
|
|
8
8
|
from cogames_agents.policy.scripted_agent.cogsguard.types import Role as CogsguardRole
|
|
9
|
-
from cogames_agents.policy.scripted_agent.common.roles import ROLE_VIBES
|
|
10
9
|
from mettagrid.policy.policy import AgentPolicy, MultiAgentPolicy
|
|
11
10
|
from mettagrid.policy.policy_env_interface import PolicyEnvInterface
|
|
12
11
|
from mettagrid.simulator import Action, AgentObservation
|
|
13
12
|
|
|
14
|
-
DEFAULT_ROLE_VIBES =
|
|
13
|
+
DEFAULT_ROLE_VIBES = ("miner", "scout", "aligner", "scrambler")
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
class CogsguardTeacherPolicy(MultiAgentPolicy):
|
|
@@ -36,6 +35,7 @@ class CogsguardTeacherPolicy(MultiAgentPolicy):
|
|
|
36
35
|
self._last_action_feature_id = self._find_feature_id("last_action")
|
|
37
36
|
|
|
38
37
|
self._role_action_ids = self._resolve_role_actions(role_vibes)
|
|
38
|
+
self._episode_index = [0] * self._num_agents
|
|
39
39
|
self._reset_episode_state()
|
|
40
40
|
|
|
41
41
|
def agent_policy(self, agent_id: int) -> AgentPolicy:
|
|
@@ -142,7 +142,6 @@ class CogsguardTeacherPolicy(MultiAgentPolicy):
|
|
|
142
142
|
return role_action_ids
|
|
143
143
|
|
|
144
144
|
def _reset_episode_state(self) -> None:
|
|
145
|
-
self._episode_index = [0] * self._num_agents
|
|
146
145
|
self._forced_vibe = [False] * self._num_agents
|
|
147
146
|
self._last_episode_pct = [-1] * self._num_agents
|
|
148
147
|
self._step_in_episode = [0] * self._num_agents
|
{cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/__init__.py
RENAMED
|
@@ -6,12 +6,12 @@ __all__ = [
|
|
|
6
6
|
"RandomAgentsMultiPolicy",
|
|
7
7
|
"ThinkyAgentsMultiPolicy",
|
|
8
8
|
"RaceCarAgentsMultiPolicy",
|
|
9
|
-
"
|
|
9
|
+
"LadyBugAgentsMultiPolicy",
|
|
10
10
|
]
|
|
11
11
|
|
|
12
12
|
# Re-export the policy classes for convenience
|
|
13
13
|
from cogames_agents.policy.nim_agents.agents import ( # noqa: F401
|
|
14
|
-
|
|
14
|
+
LadyBugAgentsMultiPolicy,
|
|
15
15
|
RaceCarAgentsMultiPolicy,
|
|
16
16
|
RandomAgentsMultiPolicy,
|
|
17
17
|
ThinkyAgentsMultiPolicy,
|
{cogames_agents-0.0.0.10 → cogames_agents-0.0.2}/src/cogames_agents/policy/nim_agents/agents.py
RENAMED
|
@@ -55,24 +55,19 @@ class RaceCarAgentsMultiPolicy(NimMultiAgentPolicy):
|
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
class
|
|
59
|
-
short_names = ["
|
|
58
|
+
class LadyBugAgentsMultiPolicy(NimMultiAgentPolicy):
|
|
59
|
+
short_names = ["ladybug"]
|
|
60
60
|
|
|
61
|
-
def __init__(
|
|
62
|
-
self,
|
|
63
|
-
policy_env_info: PolicyEnvInterface,
|
|
64
|
-
agent_ids: Sequence[int] | None = None,
|
|
65
|
-
**_: object,
|
|
66
|
-
):
|
|
61
|
+
def __init__(self, policy_env_info: PolicyEnvInterface, agent_ids: Sequence[int] | None = None):
|
|
67
62
|
super().__init__(
|
|
68
63
|
policy_env_info,
|
|
69
|
-
nim_policy_factory=na.
|
|
64
|
+
nim_policy_factory=na.LadybugPolicy,
|
|
70
65
|
agent_ids=agent_ids,
|
|
71
66
|
)
|
|
72
67
|
|
|
73
68
|
|
|
74
|
-
class
|
|
75
|
-
short_names = ["
|
|
69
|
+
class CogsguardAgentsMultiPolicy(NimMultiAgentPolicy):
|
|
70
|
+
short_names = ["cogsguard"]
|
|
76
71
|
|
|
77
72
|
def __init__(
|
|
78
73
|
self,
|
|
@@ -82,6 +77,6 @@ class CogsguardAlignAllAgentsMultiPolicy(NimMultiAgentPolicy):
|
|
|
82
77
|
):
|
|
83
78
|
super().__init__(
|
|
84
79
|
policy_env_info,
|
|
85
|
-
nim_policy_factory=na.
|
|
80
|
+
nim_policy_factory=na.CogsguardPolicy,
|
|
86
81
|
agent_ids=agent_ids,
|
|
87
82
|
)
|
|
@@ -8,8 +8,8 @@ const
|
|
|
8
8
|
CargoPerMiner = 40
|
|
9
9
|
ExploreSteps = 8
|
|
10
10
|
RoleNames = ["miner", "scout", "aligner", "scrambler"]
|
|
11
|
-
DepotTags = ["
|
|
12
|
-
HubTags = ["hub", "
|
|
11
|
+
DepotTags = ["charger", "junction", "supply_depot"]
|
|
12
|
+
HubTags = ["hub", "assembler", "main_nexus"]
|
|
13
13
|
StationTags = ["miner_station", "scout_station", "aligner_station", "scrambler_station"]
|
|
14
14
|
ResourceNames = ["carbon", "oxygen", "germanium", "silicon"]
|
|
15
15
|
|
|
@@ -21,9 +21,6 @@ const Offsets4 = [
|
|
|
21
21
|
]
|
|
22
22
|
|
|
23
23
|
type
|
|
24
|
-
SmartRoleCoordinator* = ref object
|
|
25
|
-
numAgents: int
|
|
26
|
-
|
|
27
24
|
CogsguardAgent* = ref object
|
|
28
25
|
agentId*: int
|
|
29
26
|
cfg: Config
|
|
@@ -46,15 +43,9 @@ type
|
|
|
46
43
|
chest: Option[Location]
|
|
47
44
|
|
|
48
45
|
actionIds: Table[string, int]
|
|
49
|
-
lastEpisodePct: int
|
|
50
|
-
stepInEpisode: int
|
|
51
|
-
assignedRoleIdx: int
|
|
52
|
-
lastHeart: int
|
|
53
|
-
lastInfluence: int
|
|
54
46
|
|
|
55
47
|
CogsguardPolicy* = ref object
|
|
56
48
|
agents*: seq[CogsguardAgent]
|
|
57
|
-
smartRoleCoordinator: SmartRoleCoordinator
|
|
58
49
|
|
|
59
50
|
proc getVibeName(agent: CogsguardAgent, vibeId: int): string =
|
|
60
51
|
if vibeId >= 0 and vibeId < agent.cfg.vibeNames.len:
|
|
@@ -68,91 +59,6 @@ proc actionForVibe(agent: CogsguardAgent, vibe: string): int =
|
|
|
68
59
|
let actionName = "change_vibe_" & vibe
|
|
69
60
|
return agent.getActionId(actionName)
|
|
70
61
|
|
|
71
|
-
proc roleIndex(roleName: string): int =
|
|
72
|
-
for idx, name in RoleNames:
|
|
73
|
-
if name == roleName:
|
|
74
|
-
return idx
|
|
75
|
-
return -1
|
|
76
|
-
|
|
77
|
-
proc chooseSmartRole(coordinator: SmartRoleCoordinator, policy: CogsguardPolicy, agentId: int): int =
|
|
78
|
-
discard coordinator
|
|
79
|
-
discard agentId
|
|
80
|
-
var hasHub = false
|
|
81
|
-
var hasChest = false
|
|
82
|
-
var roleCounts = newSeq[int](RoleNames.len)
|
|
83
|
-
var junctionCounts: array[3, int] # cogs, clips, neutral/unknown
|
|
84
|
-
var heartsTotal = 0
|
|
85
|
-
var influenceTotal = 0
|
|
86
|
-
var maxStructuresSeen = 0
|
|
87
|
-
|
|
88
|
-
for agent in policy.agents:
|
|
89
|
-
if agent.hub.isSome:
|
|
90
|
-
hasHub = true
|
|
91
|
-
if agent.chest.isSome:
|
|
92
|
-
hasChest = true
|
|
93
|
-
|
|
94
|
-
if agent.assignedRoleIdx >= 0 and agent.assignedRoleIdx < RoleNames.len:
|
|
95
|
-
roleCounts[agent.assignedRoleIdx] += 1
|
|
96
|
-
|
|
97
|
-
heartsTotal += agent.lastHeart
|
|
98
|
-
influenceTotal += agent.lastInfluence
|
|
99
|
-
|
|
100
|
-
let structuresSeen = agent.depots.len + agent.stations.len + agent.extractors.len
|
|
101
|
-
if structuresSeen > maxStructuresSeen:
|
|
102
|
-
maxStructuresSeen = structuresSeen
|
|
103
|
-
|
|
104
|
-
var agentCounts: array[3, int]
|
|
105
|
-
for _, alignment in agent.depots:
|
|
106
|
-
if alignment == 1:
|
|
107
|
-
agentCounts[0] += 1
|
|
108
|
-
elif alignment == -1:
|
|
109
|
-
agentCounts[1] += 1
|
|
110
|
-
else:
|
|
111
|
-
agentCounts[2] += 1
|
|
112
|
-
for i in 0 .. 2:
|
|
113
|
-
if agentCounts[i] > junctionCounts[i]:
|
|
114
|
-
junctionCounts[i] = agentCounts[i]
|
|
115
|
-
|
|
116
|
-
if not hasHub or not hasChest:
|
|
117
|
-
return roleIndex("scout")
|
|
118
|
-
|
|
119
|
-
let minerIdx = roleIndex("miner")
|
|
120
|
-
if minerIdx >= 0 and roleCounts[minerIdx] == 0:
|
|
121
|
-
return minerIdx
|
|
122
|
-
|
|
123
|
-
let knownChargers = junctionCounts[0] + junctionCounts[1] + junctionCounts[2]
|
|
124
|
-
if knownChargers == 0:
|
|
125
|
-
return roleIndex("scout")
|
|
126
|
-
|
|
127
|
-
if junctionCounts[1] > 0 and heartsTotal > 0:
|
|
128
|
-
return roleIndex("scrambler")
|
|
129
|
-
if junctionCounts[2] > 0 and heartsTotal > 0 and influenceTotal > 0:
|
|
130
|
-
return roleIndex("aligner")
|
|
131
|
-
|
|
132
|
-
if maxStructuresSeen < 10:
|
|
133
|
-
return roleIndex("scout")
|
|
134
|
-
return minerIdx
|
|
135
|
-
|
|
136
|
-
proc updateEpisodeState(agent: CogsguardAgent, episodePct: int) =
|
|
137
|
-
if episodePct == -1:
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
var newEpisode = false
|
|
141
|
-
if agent.lastEpisodePct == -1:
|
|
142
|
-
newEpisode = true
|
|
143
|
-
elif episodePct < agent.lastEpisodePct:
|
|
144
|
-
newEpisode = true
|
|
145
|
-
elif agent.lastEpisodePct > 0 and episodePct == 0:
|
|
146
|
-
newEpisode = true
|
|
147
|
-
|
|
148
|
-
if newEpisode:
|
|
149
|
-
agent.stepInEpisode = 0
|
|
150
|
-
agent.assignedRoleIdx = -1
|
|
151
|
-
else:
|
|
152
|
-
agent.stepInEpisode += 1
|
|
153
|
-
|
|
154
|
-
agent.lastEpisodePct = episodePct
|
|
155
|
-
|
|
156
62
|
proc featureValue(
|
|
157
63
|
features: seq[FeatureValue],
|
|
158
64
|
featureId: int
|
|
@@ -431,7 +337,6 @@ proc parseVisible(
|
|
|
431
337
|
result[location].add(FeatureValue(featureId: featureId.int, value: value.int))
|
|
432
338
|
|
|
433
339
|
proc step*(
|
|
434
|
-
policy: CogsguardPolicy,
|
|
435
340
|
agent: CogsguardAgent,
|
|
436
341
|
numAgents: int,
|
|
437
342
|
numTokens: int,
|
|
@@ -456,32 +361,17 @@ proc step*(
|
|
|
456
361
|
let invGermanium = agent.cfg.getInventory(visible, agent.cfg.features.invGermanium)
|
|
457
362
|
let invSilicon = agent.cfg.getInventory(visible, agent.cfg.features.invSilicon)
|
|
458
363
|
let invHeart = agent.cfg.getInventory(visible, agent.cfg.features.invHeart)
|
|
459
|
-
let invInfluence =
|
|
460
|
-
if agent.cfg.features.invInfluence != 0:
|
|
461
|
-
agent.cfg.getInventory(visible, agent.cfg.features.invInfluence)
|
|
462
|
-
else:
|
|
463
|
-
0
|
|
464
364
|
let invMiner = agent.cfg.getInventory(visible, agent.cfg.features.invMiner)
|
|
465
365
|
let invScout = agent.cfg.getInventory(visible, agent.cfg.features.invScout)
|
|
466
366
|
let invAligner = agent.cfg.getInventory(visible, agent.cfg.features.invAligner)
|
|
467
367
|
let invScrambler = agent.cfg.getInventory(visible, agent.cfg.features.invScrambler)
|
|
468
368
|
let cargo = invCarbon + invOxygen + invGermanium + invSilicon
|
|
469
369
|
|
|
470
|
-
agent.lastHeart = invHeart
|
|
471
|
-
agent.lastInfluence = invInfluence
|
|
472
|
-
|
|
473
|
-
let episodePct = agent.cfg.getEpisodeCompletionPct(visible)
|
|
474
|
-
agent.updateEpisodeState(episodePct)
|
|
475
|
-
|
|
476
370
|
var action = agent.cfg.actions.noop
|
|
477
371
|
|
|
478
372
|
if vibeName == "gear":
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
if selectedIdx < 0 or selectedIdx >= RoleNames.len:
|
|
482
|
-
selectedIdx = agent.random.rand(0 ..< RoleNames.len)
|
|
483
|
-
agent.assignedRoleIdx = selectedIdx
|
|
484
|
-
action = agent.actionForVibe(RoleNames[agent.assignedRoleIdx])
|
|
373
|
+
let choice = agent.random.rand(0 ..< RoleNames.len)
|
|
374
|
+
action = agent.actionForVibe(RoleNames[choice])
|
|
485
375
|
elif vibeName == "miner":
|
|
486
376
|
action = agent.actMiner(cargo, invMiner)
|
|
487
377
|
elif vibeName == "scout":
|
|
@@ -519,18 +409,13 @@ proc newCogsguardAgent*(agentId: int, environmentConfig: string): CogsguardAgent
|
|
|
519
409
|
result.actionIds = initTable[string, int]()
|
|
520
410
|
for id, name in config.config.actions:
|
|
521
411
|
result.actionIds[name] = id
|
|
522
|
-
result.lastEpisodePct = -1
|
|
523
|
-
result.stepInEpisode = 0
|
|
524
|
-
result.assignedRoleIdx = -1
|
|
525
|
-
result.lastHeart = 0
|
|
526
|
-
result.lastInfluence = 0
|
|
527
412
|
|
|
528
413
|
proc newCogsguardPolicy*(environmentConfig: string): CogsguardPolicy =
|
|
529
414
|
let cfg = parseConfig(environmentConfig)
|
|
530
415
|
var agents: seq[CogsguardAgent] = @[]
|
|
531
416
|
for id in 0 ..< cfg.config.numAgents:
|
|
532
417
|
agents.add(newCogsguardAgent(id, environmentConfig))
|
|
533
|
-
CogsguardPolicy(agents: agents
|
|
418
|
+
CogsguardPolicy(agents: agents)
|
|
534
419
|
|
|
535
420
|
proc stepBatch*(
|
|
536
421
|
policy: CogsguardPolicy,
|
|
@@ -552,4 +437,4 @@ proc stepBatch*(
|
|
|
552
437
|
let idx = int(ids[i])
|
|
553
438
|
let obsPtr = cast[pointer](obsArray[idx * obsStride].addr)
|
|
554
439
|
let actPtr = cast[ptr int32](actionArray[idx].addr)
|
|
555
|
-
step(policy
|
|
440
|
+
step(policy.agents[idx], numAgents, numTokens, sizeToken, obsPtr, numActions, actPtr)
|