From 994f9ef50bc780632cb9da9f9574b1fd2db5f5f1 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Thu, 31 Oct 2024 23:46:18 -0500 Subject: [PATCH] Revert "replace dice sanity checks as asserts" not sure why I would have done this, asserts are not great This reverts commit b917f78ca53a0cb1744e787ddd764d29cb600975. Signed-off-by: Brian S. Stephan --- dice/roller.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dice/roller.py b/dice/roller.py index a65192c..a03c722 100644 --- a/dice/roller.py +++ b/dice/roller.py @@ -93,8 +93,12 @@ class DiceRoller(object): size = m[1] if keep > dice or keep == 0: keep = dice - assert size >= 1, f"Die must have at least one side." - assert dice >= 1, f"At least one die must be rolled." + if size < 1: + output = "# of sides for die is incorrect: %d" % size + return output + if dice < 1: + output = "# of dice is incorrect: %d" % dice + return output res = self.roll_dice(keep, dice, size) curr_str += "%d%s" % (res[0], res[1]) res = res[0]