pmiri/pointersanddragons

Dice

dsvoid opened this issue · 1 comments

Dice
pmiri commented

Implement a C++ class that provides support for rolling dice in the game. The dice are of the following kinds (d4, d6, d8, d10, d12, d20, d100). The Dice class must allow to roll any number of dice of one kind at once using the following regular expression: xdy[+z]. Where x is the number of dice of the dy kind, optionally added with z after all the dice results have been added. The Dice class must parse a string of this form, roll the individual dice, make the addition and return an integer value.