<commit_before>#roll a number of dice
diceMuster = /[0-9]+d[0-9]+/						#a number of dice with number of sides
input = ARGV[0]										#get the first argument, should be XdY
	if(input.match(diceMuster))						#if it is number + "d" + number
		then
			number, sides = input.to_s.split(/d/)	#get the number of the dice and the sides
			number = number.to_i					#transform them into integers (either Fixnum or Bignum)
			sides = sides.to_i
			result = 0								#default value for the result so anything generated adds up
			rolls = []								#to remember the rolls
			number.times do							#roll the given times
				temp = rand(sides) + 1				#the throw itself
				rolls.push(temp)					#put the roll in the array
				result += temp						#add it to the result so far
			end
			print "You rolled #{number}d#{sides}. Result is #{result} #{rolls}"
		else
			print "#{input} is wrong as argument, usage is [number]d[number]"
	end<commit_msg>implemented rolling of multiple dice<commit_after>#roll a number of dice
diceMuster = /[0-9]+d[0-9]+/						#a number of dice with number of sides

def diceRoll(input)
	number, sides = input.to_s.split(/d/)	#get the number of the dice and the sides
	number = number.to_i					#transform them into integers (either Fixnum or Bignum)
	sides = sides.to_i
	result = 0								#default value for the result so anything generated adds up
	rolls = []								#to remember the rolls
	number.times do							#roll the given times
		temp = rand(sides) + 1				#the throw itself
		rolls.push(temp)					#put the roll in the array
		result += temp						#add it to the result so far
	end
	puts "You rolled #{number}d#{sides}. Result is #{result} #{rolls}"
end

input = ARGV[0]										#get the first argument, should be XdY
if nil==input
	puts "Missing argument: [number]d[number][+[number]d[number]]*"
elsif(input.match(/[0-9]+d[0-9]+([+][0-9]+d[0-9]+)*/))	#if there dices
	dices = input.to_s.split("+")
	dices.each{
		|dice|
		diceRoll(dice)
	}
else
	print "#{input} is wrong as argument, usage is [number]d[number][+[number]d[number]]*"
end
{'fraction_non_alphanumeric': 0.11964980544747082, 'fraction_numerical': 0.010700389105058366, 'mean_word_length': 3.1724137931034484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2378701', 'n_tokens_mistral': 843, 'n_tokens_neox': 719, 'n_words': 255}