3a9af3f54d
- 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.
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
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()
|