Ruby Koans Dice Project

I finish my day with this project in the amazing Ruby Koans learning method, and had completed 216/282! Got to see the Ruby documentation and feels like I am getting more into the syntax.
Here is the code I made in the about_dice_project.rb:

# Implement a DiceSet Class here:
class DiceSet
  attr_reader :values
  def roll(num)
    @values = []
    (1..num).each { |count| @values << rand(1..6) }
  end
  @values
end
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s