Ejemplo n.º 1
0
def main():
    myTimer = timer.begin_timer()
    stringer.show_welcome(NAME)
    print()

    while True:
        print()

        try:
            number = val.get_int("Enter number of dice to roll: ", 10,
                                 0)  # use validation module to set max 10 dice

            #create Dice object to hold the dice
            dice = Dice()
            for i in range(number):
                die = Die()
                dice.addDie(die)

            #roll dem bones!
            dice.rollAll()

            print("YOUR ROLL: ")
            # use itertor from class Dice
            for die in dice:
                print(die.getImage())
            print()

        except Exception as e:
            print("There was an Error processing your roll.", e)
            break

        choice = input("Roll again? (y/n): ").lower()
        if choice != "y":
            break

    # end while loop

    timer.stop_timer(myTimer)
    print("Bye!")