Spaces:
Sleeping
Sleeping
Commit History
-
fix(strategy): allow core detour to backtrack when three sides blocked
snapsheep_plan_core_detour 之前完全排除 opposite(后退)方向,当 heading 被墙堵死、 侧面也绕不过去时唯一出路是后退,旧实现直接返回空 → Core 永久卡在 blocked_step(线上 (-525,20) RIGHT/UP/DOWN 三向被堵 170+ tick)。 改为给 opposite 加高成本(+8)而非完全排除:正常开阔地形仍优先不后退, 只有三向被堵、无侧向绕行解时才采用后退绕行。新增回归测试覆盖该死锁。50bd52a -
fix(strategy): migration enabled never auto-stations except emergency
snapsheep迁移开启即放行:移除 migration_blocked 闸门(任一单位非 idle 动作即驻扎)。 除紧急逃生和手动 station_core 外,不再主动驻扎——单位采集/战斗/返航等 主观操作不再取消迁移会话,Core 继续平移,满载 worker 跟随迁移中的 Core, Core 停下后自然 deposit。 - decide() 不再计算/传递 migration_blocked - _decide_core 去掉 migration_blocked 参数与取消分支 - _normal_migration_allowed 去掉 migration_blocked 参数 - 更新 4 个依赖旧闸门的测试为新语义f58007f
-
fix(strategy): ranger ignores enemy workers outside defense
snapsheepRanger 非 defense 模式不再主动追射敌方 WORKER。worker 无攻击力且同速, Ranger(尤其 hp1)追它会陷入死结:追射击位→worker 横跳逃→永远差一格射 不中→持续 SHOT_MISSED 不脱战,还把 Ranger 拉离防线(线上 hp1 Ranger 被一个 横跳 worker 卡住数分钟,顺带阻断迁移闸门)。 _decide_ranger 的 shot 与 tracking 用过滤掉 WORKER 的 shot_enemies; defense 模式仍打 worker(worker 可能正在攻我 Core 附近经济)。敌方 worker 交给己方 worker 的 harass 逻辑(harass_workers 基因)处理。4f0935d -
fix(strategy): require dir_streak>=2 before lead-shot prediction
snapsheep_best_shot 对移动目标优先射 lead(预判下一格),但 moving 判定只看 prev != target,没参考 dir_streak。A-B 横跳的敌人每 tick 方向反转, dir_streak 恒为 1,下一 tick 必回原位 → lead 永远猜反 → 持续 SHOT_MISSED,hp1 目标一直打不掉(线上 Ranger 被一个横跳 Worker 卡住 数分钟不脱战,顺带阻断迁移闸门)。 修复:moving 判定加 dir_streak>=2 门槛,与 _predict_pos 一致。只有连续 同向移动 ≥2 帧才射 lead;横跳/转向时按 stationary 射 target 本身。d4f3e99 -
fix(strategy): skip low-hp retreat when Core has no resources
snapsheep_low_hp_retreat 在 Core 资源为 0 时仍触发:低血单位强行往 Core 跑,但 can_heal=False 回去了也治不了。改善方向被墙挡住时 A* 绕路第一步朝远离 Core 方向,每 tick 重算同一方向 → 单位卡在原地空转(线上 hp1 Ranger 距 Core 38 格、两改善方向皆墙时持续往远离方向挪)。 修复:can_heal=False 时直接返回 (False, None),不触发 retreat,交给正常 idle 逻辑(park/守家),等 Core 攒到资源再回血。顺带消除这类空转动作对 迁移闸门的持续阻断。59c2252 -
fix(strategy): gate migration on non-idle unit intent only
snapsheep迁移闸门从「资源/cargo + 单位动作」改为「只有基因主观操作」: - 新增 IDLE_MIGRATION_TAGS:scout/explore/patrol/park/spread/yield_core/ exit_cave/home_*/vault_*/osc_*/wait_resource/hold_full/wait/manual/ migrate_translate 均视为 idle,不阻止迁移 - migration_blocked 判定与跟随豁免集统一用 IDLE_MIGRATION_TAGS - _normal_migration_allowed 与 _decide_core 活动迁移分支移除 _migration_has_resources_or_cargo:资源/cargo 不再直接阻止迁移, 改由 worker 采集(goto_resource 非 idle)间接触发驻扎 - 修复线上 61 格远资源记忆永久卡住迁移启动的问题 紧急逃生在 _decide_core 顶部独立处理,不走闸门。1c4a266 -
fix(strategy): pause migration for unit actions
snapsheepaa17a67
-
feat(strategy): add station and migration mode toggle
snapsheep83b8781 -
fix(strategy): detour core around obstacles instead of blind retry
snapsheep1b09aea -
fix(strategy): retry automatic migration while empty
snapsheepbd17551 -
fix(strategy): translate frozen migration formation
snapsheep5695506 -
feat(deploy): persist memory and control core migration
snapsheep62068da -
feat(strategy): coordinate whole-population core migration
snapsheep7b0a690
-
Core research: deterministic simulator, evolutionary strategy, genetic algorithm
Unverified signature- ahsim/: deterministic rule engine aligned with official gameplay v0.14 (world generation, supercover vision, resolution order, game loop) - strategies/: parameterized heuristic strategy (27 evolvable genes), Strategy interface with A* pathfinding, baseline RandomBot - evolve/: fitness evaluation (N-player FFA with tiered opponents) and genetic algorithm (tournament selection, uniform crossover, gaussian mutation, elitism), fully seed-driven for reproducibility - run_evolve.py: evolution entry point (multiprocessing pool, ~8.5x) - tests/: 62 unit tests for the engine and evolution core - Zero third-party runtime dependencies (Python stdlib only)cdf3b47