<commit_before># Die Class 1: Numeric

# I worked on this challenge [by myself, with: ]

# I spent [] hours on this challenge.

# 0. Pseudocode

# Input:
# Output:
# Steps:


# 1. Initial Solution

class Die
  def initialize(sides)
    # code goes here
  end

  def sides
    # code goes here
  end

  def roll
    # code goes here
  end
end



# 3. Refactored Solution







# 4. Reflection


<commit_msg>add die solution and reflection<commit_after># Die Class 1: Numeric

# I worked on this challenge [by myself, with: ]

# I spent [] hours on this challenge.

# 0. Pseudocode

# Input: object (die) with n number of sides
# Output:
# => the number of sides the die has
# => what is rolled (a random number within range)
# Steps:
# => initalize: create new die as long as the input isn't negative
# => sides: return the number of sides
# => return a random number using sides as a maximum

# 1. Initial Solution

=begin
class Die
  def initialize(sides)
    if sides >= 1
    	@die = sides
    else
      raise ArgumentError.new ("No numbers less than 1 are allowed.")
    end
  end
  def sides
    return @die
  end
  def roll
    return rand(@die) + 1
  end
end
=end

# 3. Refactored Solution

class Die
  def initialize(sides)
  	# create a die as long as the number of sides is over 1
  	# if there is an improper number of sides, raise an argument error
    if sides >= 1
    	@die = sides
    else
      raise ArgumentError.new ("No numbers less than 1 are allowed.")
    end
  end

  def sides
  	# tell the people how many sides there are!
    return @die
  end

  def roll
  	# randomize the roll
  	# we add one to randomize from 1 to n rather than 0 to n as is default
    return rand(@die) + 1
  end
end

# 4. Reflection
=begin
	
What is an ArgumentError and why would you use one?
  An argument error is an error that shows up when an argument was wrong. Here 
  we needed positive numbers 1 or greater. So any negative numbers would have 
  been wrong and yeiled an error. You use argument errors to alert users or 
  developers that an argument was imporperly used. That way that can hopefully 
  determine what sort of argument they should be passing.

What new Ruby methods did you implement? What challenges and successes did you have 
in implementing them?
  We used the .new method on the ArgumentError. It wasn't terribly difficult, but 
  it was interesting to see that we can create argument errors of our own.

What is a Ruby class?
  A class is the "blueprint from which...objects are created."

Why would you use a Ruby class?
  It allows us to partion off a slew of rules for specific uses. Classes also 
  allow us to pass information between objects within the class (more on that 
  below).

What is the difference between a local variable and an instance variable?
  A local variable only exists within the method it is placed. It cannot 
  be accesses elsewhere. Instance variables can be used anywhere in a class 
  and are denoted via the @ symbol followed by the name.

Where can an instance variable be used?
  Across methods in the same class.

=end
{'fraction_non_alphanumeric': 0.05177993527508091, 'fraction_numerical': 0.006472491909385114, 'mean_word_length': 3.0090791180285343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2113503', 'n_tokens_mistral': 915, 'n_tokens_neox': 860, 'n_words': 488}