Skip to content

Instantly share code, notes, and snippets.

@Deep18-03
Created May 18, 2020 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deep18-03/41390937cec4ff694c93a4919c62bc97 to your computer and use it in GitHub Desktop.
Save Deep18-03/41390937cec4ff694c93a4919c62bc97 to your computer and use it in GitHub Desktop.
import random
def compare(player1,player2):
if player1==player2:
print(f"Draw the dice number is {player1}\n")
elif player1>player2:
print("player1 wins")
print(f"player1 number is: {player1} and player2 number is: {player2}")
global player1_wins
player1_wins+=1
else:
print("player2 wins")
print(f"player1 number is: {player1} and player2 number is: {player2}")
global player2_wins
player2_wins+=1
def roll_chance(player1,player2):
print("Player1 will roll the dice. Press enter to roll the dice ")
input()
if player1== 1:
print("[*************************]")
print(" ")
print(" o ")
print(" ")
print("[*************************]\n")
print(f"The dice number is: {player1}")
if player1 == 2:
print("[*************************]")
print(" ")
print(" o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player1}")
if player1==3:
print("[*************************]")
print(" ")
print(" o o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player1}")
if player1 == 4:
print("[*************************]")
print(" ")
print(" o o ")
print(" o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player1}")
if player1 == 5:
print("[*************************]")
print(" ")
print(" o o ")
print(" o ")
print(" o o ")
print("[*************************]")
print(f"The dice number is: {player1}")
if player1 == 6:
print("[*************************]")
print(" ")
print(" o o ")
print(" o o ")
print(" o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player1}\n")
# if player1 == 6:
# print("player1 will again roll the dice.press enter to roll the dice")
# input()
print("--------------------------------------------------\n")
print("Player2 will roll the dice.Press enter to roll the dice ")
input()
if player2== 1:
print("[*************************]")
print(" ")
print(" o ")
print(" ")
print("[*************************]\n")
print(f"The dice number is: {player2}")
if player2 == 2:
print("[*************************]")
print(" ")
print(" o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player2}")
if player2 == 3:
print("[*************************]")
print(" ")
print(" o o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player2}")
if player2 == 4:
print("[*************************]")
print(" ")
print(" o o ")
print(" o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player2}")
if player2 == 5:
print("[*************************]")
print(" ")
print(" o o ")
print(" o ")
print(" o o ")
print("[*************************]")
print(f"The dice number is: {player2}")
if player2 == 6:
print("[*************************]")
print(" ")
print(" o o ")
print(" o o ")
print(" o o ")
print(" ")
print("[*************************]")
print(f"The dice number is: {player2}\n")
# if player2 == 6:
# print("player2 will again roll the dice.press enter to roll the dice")
# input()
player1_wins=0
player2_wins=0
print("How many round do you want to play")
times=int(input())
# games=times
# print(games)
while times!=0:
print(f"\nRound remain to play :{times}\n")
player1 = random.randint(1, 6)
player2 = random.randint(1, 6)
roll_chance(player1,player2)
print("\n")
compare(player1,player2)
times-=1
print(f"\nResults :- Player1 total Wins:{player1_wins} and Player2 total Wins:{player2_wins}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment