ThenThereWereThings

Roll XdY+Z

Jan 25th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import random
  2. def RollDice(diceAmount):
  3. print('You are now rolling XdY')
  4. diceAmount()
  5. diceSides()
  6. n=Dice
  7. m=0
  8. p=0
  9. while n!=0:
  10. roll=random.randint(1,int(sides))
  11. m=m+1
  12. print('Dice ' +str(m) +': ' +str(roll))
  13. n=int(n)-1
  14. p=p+roll
  15. else:
  16. print ('The total is ' +str(p))
  17.  
  18. def diceAmount():
  19. print('Input X')
  20. Dice=input()
  21. while int(Dice)<1:
  22. print('Don\'t be an idiot, roll a number of dice')
  23. Dice=input()
  24. diceAmount
  25.  
  26. def diceSides():
  27. print('Input Y')
  28. sides=input()
  29. while int(sides)<1:
  30. print('Don\'t be an idiot, dice have to have sides')
  31. sides=input()
  32. diceSides
  33.  
  34. playAgain='yes'
  35. while playAgain=='yes' or playAgain=='y':
  36.  
  37. RollDice(Dice)
  38.  
  39. print('Reroll?')
  40. playAgain=input()
Advertisement
Add Comment
Please, Sign In to add comment