Question: (RUBY) Implement Dice Thrower : 4 OPEN IDE Create a Die class o It should be initializable with a pip count o Apip is the

(RUBY)

 (RUBY) Implement Dice Thrower : 4 OPEN IDE Create a Die

Implement Dice Thrower : 4 OPEN IDE Create a Die class o It should be initializable with a "pip" count o Apip" is the "dot" on the side of a die The pip count you initialize a Die with is the largest number the Die can create . If the Die is initialized without a pip count, it should default to 6 (a classic, cubical die) dots on the side of the die) o max_pips should be accessible via attr_reader A method pips should return max_pips. o A method called roll should return a random pip value. The die knows its own max_pips so we can expect this Number to be between 1 and max_pips Create a DiceRoller class o It should be initializable with two arguments: - REQUIRED: the number of dice that should be created OPTIONAL: the number of pips each die should have as its maximum. If it is not provided, the count should default to 6 . By default it should initialize with a set of 1 instance of Die o The generate_set method should return an Array of the initialized number of dice o It should store the results of generate_set in an instance variable o It should implement a method called dice that returns the generated set stored in the previous step Implement Dice Thrower : 4 OPEN IDE Create a Die class o It should be initializable with a "pip" count o Apip" is the "dot" on the side of a die The pip count you initialize a Die with is the largest number the Die can create . If the Die is initialized without a pip count, it should default to 6 (a classic, cubical die) dots on the side of the die) o max_pips should be accessible via attr_reader A method pips should return max_pips. o A method called roll should return a random pip value. The die knows its own max_pips so we can expect this Number to be between 1 and max_pips Create a DiceRoller class o It should be initializable with two arguments: - REQUIRED: the number of dice that should be created OPTIONAL: the number of pips each die should have as its maximum. If it is not provided, the count should default to 6 . By default it should initialize with a set of 1 instance of Die o The generate_set method should return an Array of the initialized number of dice o It should store the results of generate_set in an instance variable o It should implement a method called dice that returns the generated set stored in the previous step

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!