Settlers scale with empty homes: fast catch-up, slowing near full

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-19 20:35:15 +01:00
parent 8fbab37a56
commit 632a12e8bc
3 changed files with 11 additions and 10 deletions

View file

@ -315,13 +315,14 @@ class CityTest(unittest.TestCase):
city["population"] = 22.0
city["buildings"]["houses"]["level"] = 2
city["stockpile"] = {"bread": 10_000}
self.assertAlmostEqual(game.growth_per_day(world), 0.25 * 65 + 0.05 * 22)
self.assertAlmostEqual(game.growth_per_day(world), 0.5 * 43 + 0.05 * 22)
for _hour in range(24):
game._city_hour(world, T0)
self.assertGreater(city["population"], 38)
for _hour in range(48):
game._city_hour(world, T0)
self.assertEqual(city["population"], 65)
# Slower as the homes fill, but never down to nothing.
self.assertLess(game.growth_per_day(world), 0.5 * 43)
city["population"] = 64.0
self.assertAlmostEqual(game.growth_per_day(world), 0.5 + 3.2)
def test_fed_city_grows_to_housing_and_pays_tax(self):
world = world_with()