From 94965ad3f041bc029f8001060001548cbaffb313 Mon Sep 17 00:00:00 2001 From: autocommit Date: Wed, 15 Apr 2026 19:18:06 -0700 Subject: [PATCH] =?UTF-8?q?test(auto-play):=20=E2=9C=85=20Update=20test=20?= =?UTF-8?q?cases=20to=20validate=20settler=20proximity=20bias=20and=20fog?= =?UTF-8?q?=20counting=20logic=20in=20auto-play?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/game/engine/scenes/tests/auto_play.gd | 26 +++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/game/engine/scenes/tests/auto_play.gd b/src/game/engine/scenes/tests/auto_play.gd index 026c103f..57cb3a58 100644 --- a/src/game/engine/scenes/tests/auto_play.gd +++ b/src/game/engine/scenes/tests/auto_play.gd @@ -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