Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 891 Bytes

dice-challenge.md

File metadata and controls

18 lines (11 loc) · 891 Bytes

Challenge: Dice 🎲

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 and private method.
  • Make use of initialize methods.