feat: add live replays and PostgreSQL maintenance tools
Build and Push Docker Container / build-and-push (push) Successful in 7m53s
Build and Push Docker Container / build-and-push (push) Successful in 7m53s
- Stream compact live replay updates across local and clustered dashboards. - Render responsive snake bodies as SVG paths with aligned custom icons. - Add cache-busted assets, replay fallback routes, and live-follow playback. - Support PostgreSQL benchmark sampling and idempotent SQLite migration. - Add dry-run cleanup for old low-quality PostgreSQL replay payloads. - Reward safe perimeter lanes and bump Prism to version 1.5.0. - Add backend, migration, dashboard, and perimeter regression coverage.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import unittest
|
||||
|
||||
from snakes.engine.perimeter import perimeter_geometry_score
|
||||
|
||||
class TestPerimeterGeometryScore(unittest.TestCase):
|
||||
def score(self, point, **overrides):
|
||||
values = {
|
||||
"point": point,
|
||||
"current_head": (0, 5),
|
||||
"width": 11,
|
||||
"height": 11,
|
||||
"occupancy": 0.35,
|
||||
"snake_length": 12,
|
||||
"reachable_space": 80,
|
||||
"required_space": 12,
|
||||
"liberties": 2,
|
||||
"next_options": 2,
|
||||
"safe_next_options": 2,
|
||||
"tail_escape": True,
|
||||
"dead_end": False,
|
||||
"losing_head_to_head": False,
|
||||
}
|
||||
values.update(overrides)
|
||||
return perimeter_geometry_score(**values)
|
||||
|
||||
def test_safe_wall_lane_can_outscore_adjacent_inner_lane(self):
|
||||
wall = self.score((0, 6))
|
||||
inner = self.score((1, 5))
|
||||
|
||||
self.assertGreater(wall, inner)
|
||||
|
||||
def test_unsafe_wall_does_not_receive_perimeter_reward(self):
|
||||
safe_wall = self.score((0, 6))
|
||||
unsafe_wall = self.score((0, 6), safe_next_options=1)
|
||||
|
||||
self.assertGreater(safe_wall, unsafe_wall + 30.0)
|
||||
|
||||
def test_corner_is_less_attractive_than_straight_edge(self):
|
||||
corner = self.score((0, 0), current_head=(0, 1))
|
||||
straight_edge = self.score((0, 6))
|
||||
|
||||
self.assertGreater(straight_edge, corner)
|
||||
|
||||
def test_losing_head_to_head_never_gets_perimeter_reward(self):
|
||||
safe_wall = self.score((0, 6))
|
||||
contested_wall = self.score((0, 6), losing_head_to_head=True)
|
||||
|
||||
self.assertGreater(safe_wall, contested_wall + 30.0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -52,8 +52,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.4.0")
|
||||
self.assertEqual(get_snake_version("PrismBattleSnake_GPT_5_6_Sol"), "1.4.0")
|
||||
self.assertEqual(snake.version, "1.5.0")
|
||||
self.assertEqual(get_snake_version("PrismBattleSnake_GPT_5_6_Sol"), "1.5.0")
|
||||
self.assertGreaterEqual(snake._planning_depth, 4)
|
||||
self.assertIsInstance(SnakeBuilder.build("PrismBattleSnake_GPT_5_6_Sol"), PrismBattleSnake_GPT_5_6_Sol)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user