From 95d854011666119071ff648c89f41cc637d48453 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 4 Jan 2026 02:43:33 -0500 Subject: [PATCH] add randomization for planting carrots or pumpkins in top-right quadrant --- f2.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/f2.py b/f2.py index 7de6551..f4e89ab 100644 --- a/f2.py +++ b/f2.py @@ -54,9 +54,12 @@ while True: utils.move_to(0, worldSize / 2) plant_alternating(worldSize / 2, worldSize / 2, [ Entities.Tree, Entities.Bush ]) - utils.move_to(worldSize / 2, worldSize / 2) - 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) \ No newline at end of file + # the top right quadrant is 50% of the time pumpkin, 50% of the time carrots + if random() < 0.5: + plant_carrots(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) \ No newline at end of file