add randomization for planting carrots or pumpkins in top-right quadrant

This commit is contained in:
2026-01-04 02:43:33 -05:00
parent a8fbe5a74c
commit 95d8540116

13
f2.py
View File

@@ -54,9 +54,12 @@ while True:
utils.move_to(0, worldSize / 2) utils.move_to(0, worldSize / 2)
plant_alternating(worldSize / 2, worldSize / 2, [ Entities.Tree, Entities.Bush ]) plant_alternating(worldSize / 2, worldSize / 2, [ Entities.Tree, Entities.Bush ])
utils.move_to(worldSize / 2, worldSize / 2) utils.move_to(worldSize / 2, worldSize / 2)
plant_pumpkin(worldSize / 2, worldSize / 2) # the top right quadrant is 50% of the time pumpkin, 50% of the time carrots
utils.move_to(worldSize / 2, worldSize / 2) if random() < 0.5:
while verify_pumpkin(worldSize / 2, worldSize / 2): plant_carrots(worldSize / 2, worldSize / 2)
utils.move_to(worldSize / 2, worldSize / 2) else:
plant_pumpkin(worldSize / 2, worldSize / 2)
utils.move_to(worldSize / 2, worldSize / 2)
while verify_pumpkin(worldSize / 2, worldSize / 2):
utils.move_to(worldSize / 2, worldSize / 2)