test(auto-play): Update test cases to validate settler proximity bias and fog counting logic in auto-play

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-15 19:18:06 -07:00
parent c03186b9ae
commit 94965ad3f0

View file

@ -1265,8 +1265,15 @@ func _explore(unit: Variant, player: RefCounted, game_map: RefCounted) -> void:
if reachable.size() <= 1:
return
# Find settler position for proximity bias
var settler_pos: Vector2i = Vector2i(-1, -1)
for u: Variant in player.units:
if u.get("can_found_city") == true and u.is_alive():
settler_pos = u.position
break
var best_pos: Vector2i = unit.position
var best_score: int = -1
var best_score: float = -1.0
var any_valid: Vector2i = unit.position
for pos: Vector2i in reachable:
@ -1274,15 +1281,26 @@ func _explore(unit: Variant, player: RefCounted, game_map: RefCounted) -> void:
continue
if any_valid == unit.position:
any_valid = pos
var score: int = 0
var fog_count: float = 0.0
var food_hint: float = 0.0
var neighbors: Array[Vector2i] = HexUtilsScript.get_neighbors(pos)
for n: Vector2i in neighbors:
var norm: Vector2i = HexUtilsScript.normalize_position(
n, game_map.width, game_map.height, game_map.wrap_mode
)
var tile: Resource = game_map.get_tile(norm)
if tile != null and tile.get_visibility(player.index) == 0:
score += 1
if tile == null:
continue
if tile.get_visibility(player.index) == 0:
fog_count += 1.0
else:
var ny: Dictionary = tile.get_yields(player.index)
food_hint += float(int(ny.get("food", 0)))
var score: float = fog_count * 2.0 + food_hint * 3.0
if settler_pos.x >= 0:
var dist: int = HexUtilsScript.hex_distance(pos, settler_pos)
if dist <= 5:
score += float(6 - dist) * 1.5
if score > best_score:
best_score = score
best_pos = pos