tdunham99

twodice

Jul 9th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. """Try and guess what the computer rolled with two dice! Woah!"""
  2.  
  3. """
  4.    Goals:
  5.    - Add a score system
  6.    - Add a min value w/ appropriate messages
  7. """
  8.  
  9. from random import randint
  10. from time import sleep
  11.  
  12. def get_user_guess():
  13.     guess = int(input("Guess what the computer rolled with two dice: "))
  14.     return guess
  15.  
  16. def roll_dice(number_of_sides):
  17.     first_roll = randint(1, number_of_sides)
  18.     second_roll = randint(1, number_of_sides)
  19.     max_val = number_of_sides * 2
  20.     print("The max guess is: %d" % max_val)
  21.     guess = get_user_guess()
  22.     if guess > max_val:
  23.         print("That's over the max guess bruh lmao")
  24.     else:
  25.         print("Rolling...")
  26.         sleep(2)
  27.         print("First roll: %d" % first_roll)
  28.         sleep(1)
  29.         print("Second roll: %d" % second_roll)
  30.         sleep(1)
  31.         total_roll = first_roll + second_roll
  32.         print("Computer got: %d" % total_roll)
  33.         print("Result...")
  34.         sleep(1)
  35.         if guess > total_roll:
  36.             print("You won bruh!")
  37.         else:
  38.             print("Damn you lost")
  39. roll_dice(6)
Advertisement
Add Comment
Please, Sign In to add comment