feat(snake): add adaptive adversarial search
- Share duel search contexts and transpositions across candidate moves. - Add aspiration windows, principal variation ordering, and body caches. - Model simultaneous multiplayer responses with a compact beam rollout. - Adapt search depth and response breadth to the remaining deadline. - Add a deterministic arena benchmark with optional JSON reporting. - Expose search metrics, document benchmarking, and bump Prism to 1.2.0.
This commit is contained in:
+5
-3
@@ -326,15 +326,15 @@ class BitBoard:
|
||||
# index when several foods are equally close, which can change contested-
|
||||
# food scoring and therefore the selected move.
|
||||
queue = [start_idx]
|
||||
distances = [0]
|
||||
seen = start_bit
|
||||
cursor = 0
|
||||
layer_end = 1
|
||||
dist = 0
|
||||
w = self.width
|
||||
size = self.size
|
||||
|
||||
while cursor < len(queue):
|
||||
cell = queue[cursor]
|
||||
dist = distances[cursor]
|
||||
cursor += 1
|
||||
x = cell % w
|
||||
candidates = (
|
||||
@@ -357,6 +357,8 @@ class BitBoard:
|
||||
return dist + 1, neighbor
|
||||
seen |= bit
|
||||
queue.append(neighbor)
|
||||
distances.append(dist + 1)
|
||||
if cursor == layer_end:
|
||||
dist += 1
|
||||
layer_end = len(queue)
|
||||
|
||||
return None, None
|
||||
|
||||
Reference in New Issue
Block a user