diff --git a/README.md b/README.md index 45aa284..8a5ab77 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,4 @@ assignment_ruby_warmup Dice, dice, baby. [A Ruby assignment from the Viking Codes School](http://www.vikingcodeschool.com) +by Priscila Heller diff --git a/dice_roll.rb b/dice_roll.rb new file mode 100644 index 0000000..3c220d2 --- /dev/null +++ b/dice_roll.rb @@ -0,0 +1,13 @@ +possible_outcome1 = [1,2,3,4,5,6] +print "How many dice would you like to roll? " +dice_to_be_rolled = gets.chomp.to_s +case dice_to_be_rolled +when "1" + puts possible_outcome1[rand(possible_outcome1.length)] +when "2" + puts possible_outcome1[rand(possible_outcome1.length)] + possible_outcome1[rand(possible_outcome1.length)] +when "3" + puts possible_outcome1[rand(possible_outcome1.length)] + possible_outcome1[rand(possible_outcome1.length)] + possible_outcome1[rand(possible_outcome1.length)] +else + puts "You can choose to roll 1, 2 or 3 dice. Good Luck!" +end