Balance crop section maturity and distance

This commit is contained in:
Tanner
2026-11-09 01:21:44 +00:00
parent b642204ced
commit 7e43001d9d
2 changed files with 61 additions and 13 deletions
+20
View File
@@ -43,6 +43,26 @@ class TestCropSectionPriority(unittest.TestCase):
self.assertEqual(next_patch, carrot_a)
self.assertEqual(next_patch_size, 4)
def test_farther_section_wins_when_much_more_mature(self):
near_patch = {
(3, 64, 0), (2, 64, 0), (1, 64, 0), (0, 64, 0),
(3, 64, 1), (2, 64, 1), (1, 64, 1), (0, 64, 1),
(3, 64, 2), (2, 64, 2),
}
near_mature = (3, 64, 0)
far_patch = {
(4, 64, 0), (5, 64, 0), (4, 64, 1), (5, 64, 1),
}
crop_types = {position: 'wheat' for position in near_patch}
crop_types.update({position: 'carrots' for position in far_patch})
crop, size = self.job._select_crop(
[near_mature, *far_patch], crop_types, (0, 64, 0))
self.assertEqual(crop, (4, 64, 0))
self.assertEqual(size, len(far_patch))
self.assertEqual(self.job.active_section_maturity, (4, 4))
def test_unripe_same_species_blocks_keep_patch_connected(self):
mature = (0, 64, 0)
replanted = (1, 64, 0)