Files
snake-python/snakes/__init__.py
T
daniel156161 c704fbc742
Build and Push Docker Container / build-and-push (push) Successful in 8m3s
feat: add Prism snake and gameplay database lifecycle
- Add bitboard-accelerated Prism and versioned Supreme snake implementations.
- Add database-backed move benchmarks and focused strategy tests.
- Normalize gameplay storage while preserving replay compatibility.
- Add deterministic game quality scoring and replay retention tiers.
- Add backup-first SQLite cleanup, verification, and replacement tooling.
- Add safe compact-plus-delta database merging with conflict detection.
- Extend SQLite and PostgreSQL schemas for replay and quality metadata.
- Add PostgreSQL development service and pytest import configuration.
- Update gameplay documentation and the quart_common submodule revision.
2026-08-01 16:21:02 +02:00

47 lines
1.2 KiB
Python

import importlib
SNAKE_REGISTRY = {
"TemplateSnake": "1.0.0",
"DummSnake": "1.0.0",
"LogicSnake": "1.1.0",
"MasterSnake": "1.2.0",
"BetterMasterSnake": "1.3.0",
"BestBattleSnake": "2.6.0",
"TrainedBattleSnake": "0.1.0",
"UltimateBattleSnake": "4.5.0",
"ApexBattleSnake": "1.0.0",
"SupremeBattleSnake_ClaudeOpus4_6": "1.0.0",
"PrismBattleSnake_GPT_5_6_Sol": "1.0.0",
}
DEFAULT_SNAKE_CONFIG = {
'apiversion': '1',
'author': '',
'color': '#888888',
'head': 'default',
'tail': 'default',
}
def build_snake(selected_snake:str):
if selected_snake not in SNAKE_REGISTRY:
raise ValueError(f"Unknown snake: {selected_snake}")
snake_module = importlib.import_module(f"snakes.{selected_snake}")
snake_class = getattr(snake_module, selected_snake)
return snake_class()
def get_snake_version(selected_snake:str) -> str|None:
version = SNAKE_REGISTRY.get(selected_snake)
if version is None:
return None
return str(version)
class SnakeBuilder:
@classmethod
def build(self, selected_snake: str):
return build_snake(selected_snake)
@classmethod
def get_version(self, selected_snake:str) -> str|None:
return get_snake_version(selected_snake)