Account for cases where the target is higher than Jug A's capacity
This commit is contained in:
parent
f06ea2136f
commit
ea11be8560
1 changed files with 4 additions and 0 deletions
|
|
@ -5,6 +5,10 @@
|
||||||
def fillJug(rounds, jugA, jugB, target):
|
def fillJug(rounds, jugA, jugB, target):
|
||||||
pour = 0
|
pour = 0
|
||||||
|
|
||||||
|
if target > jugA["cap"]:
|
||||||
|
print("Target is too high. Reducing target to Jug A's capacity.")
|
||||||
|
target = jugA["cap"]
|
||||||
|
|
||||||
if jugA["state"] == target:
|
if jugA["state"] == target:
|
||||||
print("Target reached")
|
print("Target reached")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue