Bank: a full stack spills into another slot
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fb37bcef98
commit
71d7ca704b
5 changed files with 41 additions and 15 deletions
|
|
@ -100,10 +100,10 @@ class ActionTest(unittest.TestCase):
|
|||
def test_full_bank_overflows_to_city(self):
|
||||
world = world_with(("fred", "warrior"))
|
||||
p = world["players"]["fred"]
|
||||
p["bank"] = {"stone": game.BASE_STACK - 2}
|
||||
p["bank"] = {"stone": game.BASE_STACK * game.BASE_SLOTS - 2}
|
||||
game.start_action(world, p, "mine_stone", T0)
|
||||
summary = game.process_player(world, p, T0 + 100, random.Random(1))
|
||||
self.assertEqual(p["bank"]["stone"], game.BASE_STACK)
|
||||
self.assertEqual(p["bank"]["stone"], game.BASE_STACK * game.BASE_SLOTS)
|
||||
self.assertEqual(summary["overflow"], {"stone": 3})
|
||||
self.assertEqual(world["city"]["stockpile"]["stone"], 3)
|
||||
self.assertEqual(p["favour"], 1.5) # half favour for overflow
|
||||
|
|
@ -112,7 +112,7 @@ class ActionTest(unittest.TestCase):
|
|||
def test_full_bank_sells_what_the_city_cannot_use(self):
|
||||
world = world_with(("fred", "warrior"))
|
||||
p = world["players"]["fred"]
|
||||
p["bank"] = {"copper_ore": game.BASE_STACK - 1}
|
||||
p["bank"] = {"copper_ore": game.BASE_STACK * game.BASE_SLOTS - 1}
|
||||
game.start_action(world, p, "mine_copper", T0)
|
||||
summary = game.process_player(world, p, T0 + 100, random.Random(1))
|
||||
self.assertEqual(summary["sold"], {"copper_ore": 3})
|
||||
|
|
@ -131,6 +131,17 @@ class ActionTest(unittest.TestCase):
|
|||
self.assertIn("Walls", game.city_uses("bricks"))
|
||||
self.assertEqual(game.city_uses("bread"), ["the granary"])
|
||||
|
||||
def test_a_full_stack_spills_into_another_slot(self):
|
||||
world = world_with(("fred", "warrior"))
|
||||
p = world["players"]["fred"]
|
||||
p["bank"] = {"coal": game.BASE_STACK, "logs": 10}
|
||||
self.assertEqual(game.slots_used(world, p), 2)
|
||||
self.assertEqual(game.bank_room(world, p, "coal"), (game.BASE_SLOTS - 2) * game.BASE_STACK)
|
||||
self.assertEqual(game.bank_room(world, p, "logs"), game.BASE_STACK - 10 + (game.BASE_SLOTS - 2) * game.BASE_STACK)
|
||||
p["bank"]["coal"] = 2500
|
||||
self.assertEqual(game.slots_used(world, p), 4) # 1000 + 1000 + 500, plus the logs
|
||||
self.assertEqual(game.bank_room(world, p, "coal"), 500 + (game.BASE_SLOTS - 4) * game.BASE_STACK)
|
||||
|
||||
def test_full_bank_can_stop_instead(self):
|
||||
world = world_with(("fred", "warrior"))
|
||||
p = world["players"]["fred"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue