In this challenge the goal is to model a set of dice. Create a DiceSet
class, each will contain two Dice
instances (create a class for it too).
Create a roll
method for DiceSet
which rolls both dice. Each Dice is 6 sided and should return a random number each time it is rolled. rand()
can be used to achieve this.
Create another method for DiceSet
called display which will show values of both dice.
Once both classes work as expected, create a Ruby script and require each class to its init.rb
.
The script should have introductory text, and a loop which gets user input. The user can type 'r'
to roll again or q
to quit the script.
Further notes:
- Follow best practices for scripts and file organization.
- Use instance variables and attribute methods.
- Use at least one
public
andprivate
method. - Make use of initialize methods.