Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- count = 0
- running = True
- rollTotal =0
- def dice(dieValue): #defines the ascii art of the die
- if (dieValue == 1):
- print('_______')
- print('| |')
- print('| o |')
- print('| |')
- print('_______')
- if (dieValue == 2):
- print('_______')
- print('| o |')
- print('| |')
- print('| o |')
- print('_______')
- if (dieValue == 3):
- print('_______')
- print('| o |')
- print('| o |')
- print('| o |')
- print('_______')
- if (dieValue == 4):
- print('_______')
- print('| o o |')
- print('| |')
- print('| o o |')
- print('_______')
- if (dieValue == 5):
- print('_______')
- print('| o o |')
- print('| o |')
- print('| o o |')
- print('_______')
- if (dieValue == 6):
- print('_______')
- print('| o o o |')
- print('| o o o |')
- print('| o o o |')
- print('_______')
- def roll(a): #takes an argument for number of die, rolls them, and prints the total
- rollTotal =0
- count = 0
- while (count < a):
- dice(random.randint(1, 6))
- count = count+1
- rollTotal = rollTotal+1
- print('Total: '+ str(rollTotal))
- while(running == True):#main driver. prompts number of dice and passes that to the roll method
- print('How many die would you like to use?')
- numberOfDice = int(input())
- roll(numberOfDice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement