# Die Class 1: Numeric

# I worked on this challenge [by myself.]

# I spent [3] hours on this challenge.

# 0. Pseudocodes

# Input: The number of sides on the dice.
# Output: Random selection of dice (between 1 and 6)
# Steps:
# - Test argument by seeing if it's greater than 0.
# - Create instance variable to meet parameter
# - If it doesn't, raise ArgumentError
# - Create sides method to create instance variable for class
# - Create roll method to return random number of sides

# 1. Initial Solution

class Die
  def initialize(sides)
    if sides < 1
      raise ArgumentError.new(“This number should be be greater than or equal to one.”)
    else
      @sides = sides
  end
end

  def sides
    @sides
  end

  def roll
    rand(1..@sides)
  end
end

# 4. Reflection

# What is an ArgumentError and why would you use one?
# An argument error is when there is the wrong number of arguments supplied within a method.

# What new Ruby methods did you implement? What challenges and successes did you have in implementing them?
# One method used was rand, which generates a range of values and then produces a number from that range.
# What is a Ruby class?
# It's described as a blueprint for creating objects.
# Why would you use a Ruby class?
# It serves as a way to take a group of functions and position them inside a container to access them.  In short, you can use classes to create/instantiate objects.
# What is the difference between a local variable and an instance variable?
# Local variables can operate within methods, whereas instance variables function within classes.
# Where can an instance variable be used?
# Within a class.
