fix: resolve duel roots and recover legacy snake data

- Resolve selected moves and enemy replies on the same simulated turn.
- Add an Apex candidate hook and bump the Prism snake to version 1.1.0.
- Rebuild benchmark states from normalized turn data when snapshots are empty.
- Synthesize missing game snake identities during legacy database migration.
- Add regression coverage for duel timing and partial legacy schemas.
This commit is contained in:
2026-08-01 19:11:32 +02:00
parent c646392b84
commit 6643eb35af
8 changed files with 329 additions and 39 deletions
@@ -51,8 +51,8 @@ class TestPrismBattleSnake_GPT_5_6_Sol(unittest.TestCase):
snake = PrismBattleSnake_GPT_5_6_Sol()
self.assertEqual(snake.name, "PrismBattleSnake")
self.assertEqual(snake.version, "1.0.1")
self.assertEqual(get_snake_version("PrismBattleSnake_GPT_5_6_Sol"), "1.0.1")
self.assertEqual(snake.version, "1.1.0")
self.assertEqual(get_snake_version("PrismBattleSnake_GPT_5_6_Sol"), "1.1.0")
self.assertIsInstance(SnakeBuilder.build("PrismBattleSnake_GPT_5_6_Sol"), PrismBattleSnake_GPT_5_6_Sol)
def test_bitboard_primitives_match_apex(self):
@@ -100,6 +100,50 @@ class TestPrismBattleSnake_GPT_5_6_Sol(unittest.TestCase):
self.assertGreater(value, 0)
def test_candidate_search_resolves_enemy_reply_on_the_same_turn(self):
board = BitBoard(3, 3)
search = BitboardDuelSearch(
board=board, food=set(), hazards=set(), hazard_count={},
hazard_damage=15, deadline=None,
)
my_body = [{"x": 0, "y": 1}, {"x": 0, "y": 0}]
enemy_body = [{"x": 2, "y": 1}, {"x": 2, "y": 0}]
value, depth = search.search_candidate(
my_body=my_body,
enemy_body=enemy_body,
my_target=(1, 1),
my_health=100,
enemy_health=100,
max_depth=1,
previous_hazards=set(),
)
self.assertEqual(value, -500.0)
self.assertEqual(depth, 1)
def test_candidate_search_does_not_advance_our_snake_twice_at_root(self):
board = BitBoard(4, 1)
search = BitboardDuelSearch(
board=board, food=set(), hazards=set(), hazard_count={},
hazard_damage=15, deadline=None,
)
my_body = [{"x": 0, "y": 0}]
enemy_body = [{"x": 3, "y": 0}]
value, depth = search.search_candidate(
my_body=my_body,
enemy_body=enemy_body,
my_target=(1, 0),
my_health=100,
enemy_health=100,
max_depth=1,
previous_hazards=set(),
)
self.assertEqual(value, 0.0)
self.assertEqual(depth, 1)
def test_duel_search_keeps_tail_blocked_when_its_snake_eats(self):
board = BitBoard(3, 3)
search = BitboardDuelSearch(