Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- from random import randint
- def roll():
- dice_reps = ("",
- " _ _ _ \n | |\n | . |\n |_ _ _|\n ",
- " _ _ _ \n | |\n | . . |\n |_ _ _|\n ",
- " _ _ _ \n | |\n | ... |\n |_ _ _|\n ",
- " _ _ _ \n | . . |\n | . . |\n |_ _ _|\n ",
- " _ _ _ \n | . . |\n | .`. |\n |_ _ _|\n ",
- " _ _ _ \n | ... |\n | ... |\n |_ _ _|\n ")
- value = randint(1, 6)
- print dice_reps[value]
- return value
- answer = raw_input('Roll the dice? [Y/n]\n> ')
- while answer.lower() in ('', 'y', 'yes', 'k', 'ok'):
- answer2 = raw_input('How many times? [1-5]\n> ')
- total = 0
- for x in range(int(answer2)):
- total += roll()
- print "Total =", total, "\n"
- answer = raw_input('Again? [Y/n]\n> ')
- print 'Thanks for playing!'
- time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement