Skip to content

Instantly share code, notes, and snippets.

@epoch
Forked from lyntco/q018-dice.md
Last active August 29, 2015 14:14
Show Gist options
  • Save epoch/7e567f138f97c71904a5 to your computer and use it in GitHub Desktop.
Save epoch/7e567f138f97c71904a5 to your computer and use it in GitHub Desktop.

Quiz - Dice

Write a program to generate a standard dice roll.

Dice.roll
# => 6

It should give you a different result each time.

Dice.roll
# => 5
Dice.roll
# => 2

When you pass in a number, it rolls the dice that many times, and returns you the array of rolled dice

Dice.roll(3)
# => [2,5,1]

Extension

write another method that display die faces instead of a integer.

Dice.pretty_roll
________
| *  * |
| *  * |
________
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment