Skip to content

Commit

Permalink
Update to recent fix
Browse files Browse the repository at this point in the history
Update recent fix to check not only queued rolls that start with 0 but also
when they have additional numbers
  • Loading branch information
Humblemonk committed Apr 4, 2024
1 parent a54501e commit 86eaa44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dice_maiden_logic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def convert_input_to_rpn_queue(event, input)
while input_queue.length > 0
input_queue_peek = input_queue.last

# raise an error if input queue starts with a 0
raise 'Invalid dice format!' if input_queue_peek.match?(/\A0/)
# raise an error if input queue starts with a 0 followed by an int
raise 'Invalid dice format!' if input_queue_peek.match?(/\A0\d+/)

if input_queue_peek.match?(/\b\d+\b/) # If constant in string form
output_queue.prepend(Integer(input_queue.pop))
Expand Down

0 comments on commit 86eaa44

Please sign in to comment.