From f06ea2136f0e14f11b9d1aef060120b001a783e5 Mon Sep 17 00:00:00 2001 From: lolabird Date: Thu, 29 Feb 2024 15:16:32 -0700 Subject: [PATCH] Add condition for when the target is also the cap for jug A --- thinkcspy/Chapter-16-Exercises/Problem9and10_gallons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thinkcspy/Chapter-16-Exercises/Problem9and10_gallons.py b/thinkcspy/Chapter-16-Exercises/Problem9and10_gallons.py index 08aec08..f1af4ac 100644 --- a/thinkcspy/Chapter-16-Exercises/Problem9and10_gallons.py +++ b/thinkcspy/Chapter-16-Exercises/Problem9and10_gallons.py @@ -23,7 +23,7 @@ def fillJug(rounds, jugA, jugB, target): jugB["state"] -= pour print(rounds, jugA, jugB) - if jugA["state"] == jugA["cap"]: + if jugA["state"] == jugA["cap"] and jugA["state"] != target: jugA["state"] = 0 #empty jugA if full print(rounds, jugA, jugB)