-
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dice] Handle negative numbers and uppercase letters.
First, add case-insensitivity to the "d" and "v" letters in the input regex by capturing [dD] and [vV] in regexes. Next, make sure we can handle negative numbers properly by capturing a possible "-" in front of any numbers. If dice_num or dice_type ends up negative, abort _roll_dice early (dice_type already had a negative check that wasn't being hit because "-" wasn't captured).
- Loading branch information
Showing
1 changed file
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters