Skip to content

Instantly share code, notes, and snippets.

@woodruffw
Created June 29, 2017 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodruffw/19c5a09e5a49dc3b8a5ae780141d5e7b to your computer and use it in GitHub Desktop.
Save woodruffw/19c5a09e5a49dc3b8a5ae780141d5e7b to your computer and use it in GitHub Desktop.
pairs = gets.chomp.split.map { |p| p.split(/d/i).map(&:to_i) }
pairs.each { |s, t| puts "You rolled %s" % [*1..s].sample(t).reduce(:+) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment