Skip to content

Commit

Permalink
fix interact module incorrectly calling reset with arg
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicprice committed Jan 29, 2023
1 parent 86333ba commit 54e8d58
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/endplay/interact/frontends/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ def do_redeal(self, arg):
Example 1: redeal
Example 2: redeal N:95..A. 8.5.Q. .QT5.. Q..T4.
"""
self.deal.reset()
if arg:
try:
self.deal.reset(arg)
new_deal = Deal(arg)
for player, hand in new_deal:
self.deal[player] = hand
except RuntimeError:
print(f"Invalid PBN string: `{arg}`")
else:
self.deal = Deal()
self.needs_printing = True

def do_shuffle(self, arg):
Expand All @@ -144,10 +145,12 @@ def do_shuffle(self, arg):
try:
new_deal = generate_deal(arg)
except RuntimeError:
print("Could not generate deal satisfying this constraint")
raise RuntimeError("Could not generate deal satisfying this constraint")
else:
new_deal = generate_deal()
self.deal.reset(str(new_deal))
self.deal.reset()
for player, hand in new_deal:
self.deal[player] = hand
self.needs_printing = True

def do_first(self, arg):
Expand Down

0 comments on commit 54e8d58

Please sign in to comment.