feat(snake): modularize engine and add tournament tools

- Split active strategies, reusable engine code, core classes, and legacy snakes.
- Replace implicit snake imports with explicit module registrations.
- Extract Prism duel, spatial, and survival behavior into focused mixins.
- Improve duel scoring with food races, pressure, caches, and depth metrics.
- Add deterministic arena scenarios and paired seeded engine tournaments.
- Expand benchmark telemetry and bump Prism to version 1.3.0.
- Update documentation and tests for the new package layout and tooling.
This commit is contained in:
2026-08-01 20:25:07 +02:00
parent cb6c8d4dc8
commit 3a9af3f54d
39 changed files with 1447 additions and 768 deletions
+35
View File
@@ -0,0 +1,35 @@
import unittest
from snakes import SNAKE_REGISTRATIONS, SnakeBuilder
from snakes.engine import (
BitBoard,
BitboardDuelMixin,
BitboardSpatialMixin,
BitboardSurvivalMixin,
)
from snakes.strategies.prism import PrismBattleSnake_GPT_5_6_Sol
class TestSnakePackageLayout(unittest.TestCase):
def test_registry_uses_explicit_package_modules(self):
for name, registration in SNAKE_REGISTRATIONS.items():
with self.subTest(name=name):
self.assertTrue(registration.module.startswith("snakes."))
self.assertNotEqual(registration.module, f"snakes.{name}")
def test_registry_builds_active_strategies_after_package_move(self):
for name in ("ApexBattleSnake", "PrismBattleSnake_GPT_5_6_Sol"):
with self.subTest(name=name):
snake = SnakeBuilder.build(name)
self.assertEqual(snake.__class__.__name__, name)
def test_prism_composes_reusable_engine_mixins(self):
snake = PrismBattleSnake_GPT_5_6_Sol()
self.assertIsInstance(snake, BitboardDuelMixin)
self.assertIsInstance(snake, BitboardSpatialMixin)
self.assertIsInstance(snake, BitboardSurvivalMixin)
self.assertIsInstance(snake._get_bb(11, 11), BitBoard)
if __name__ == "__main__":
unittest.main()