From 0665a98bb88b4f53abe32cd6e1f0f970a02a2db6 Mon Sep 17 00:00:00 2001 From: autocommit Date: Wed, 15 Apr 2026 23:28:23 -0700 Subject: [PATCH] =?UTF-8?q?feat(mc-city):=20=E2=9C=A8=20Update=20city=20ge?= =?UTF-8?q?neration=20and=20block=20simulation=20rules=20for=20Minecraft?= =?UTF-8?q?=20simulator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/simulator/crates/mc-city/src/city.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/simulator/crates/mc-city/src/city.rs b/src/simulator/crates/mc-city/src/city.rs index 510a1955..90c4a037 100644 --- a/src/simulator/crates/mc-city/src/city.rs +++ b/src/simulator/crates/mc-city/src/city.rs @@ -122,15 +122,16 @@ pub fn growth_threshold(population: u32) -> f64 { 15.0 + 6.0 * p + p.powf(1.8).floor() } -/// Civ5-style culture border expansion threshold. -/// First ring at 10, then roughly 10 * 1.5^(tiles_owned - 7). -/// Simplified: 10 + 5 * (expansions)^1.2 +/// Border expansion threshold. Tuned so a single city reaches ≥20 tiles +/// within 150 turns on ~2-3 culture/turn (center baseline + tile culture, +/// monument optional). Linear growth at 1/exp keeps late expansions +/// affordable: exp 20 cumulative = 290, ~145 turns at 2 culture/turn. +/// Prior curve 10+5*n^1.2 capped cities at ~14 expansions in 150 turns. pub fn culture_expansion_threshold(expansions_so_far: u32) -> f64 { if expansions_so_far == 0 { - return 10.0; + return 5.0; } - let n = expansions_so_far as f64; - 10.0 + 5.0 * n.powf(1.2) + 5.0 + expansions_so_far as f64 } /// A city with full state: population, growth, food, production queues, @@ -733,13 +734,13 @@ mod tests { city.owned_tiles.push((6, 5)); city.worked_tiles.push((6, 5)); let ty = vec![ - TileYield { coord: (6, 5), culture: 5.0, ..TileYield::default() }, + TileYield { coord: (6, 5), culture: 1.0, ..TileYield::default() }, ]; - // Threshold for first expansion: 10.0 + // Threshold for first expansion: 5.0. Per-turn culture = 2 (center) + 1 (tile) = 3. assert!(!city.can_expand()); - assert!(!city.process_culture(&ty)); // 5 culture < 10 threshold + assert!(!city.process_culture(&ty)); // 3 culture < 5 threshold assert!(!city.can_expand()); - assert!(city.process_culture(&ty)); // now 10.0 >= 10 threshold + assert!(city.process_culture(&ty)); // now 6.0 >= 5 threshold assert!(city.can_expand()); // Expand with candidates