feat(mc-city): ✨ Update city generation and block simulation rules for Minecraft simulator
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
d8dd4de7d1
commit
0665a98bb8
1 changed files with 11 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue