diff --git a/Rolling_Dice100 b/Rolling_Dice100 new file mode 100644 index 0000000..5c7a5c5 --- /dev/null +++ b/Rolling_Dice100 @@ -0,0 +1,36 @@ +# python +import random +import time + +def race(): + player1 = 0 + player2 = 0 + + print("Welcome to the race!") + print("The race is about to begin...") + + while player1 < 100 and player2 < 100: + # Generate random numbers between 1 and 6 for each player + player1_roll = random.randint(1, 6) + player2_roll = random.randint(1, 6) + + # Update positions of the players + player1 += player1_roll + player2 += player2_roll + + # Display the positions of the players + print("Player 1:", "#" * player1) + print("Player 2:", "#" * player2) + print() + + # Pause for a moment between each roll + time.sleep(0.5) + + if player1 >= 100 and player2 >= 100: + print("It's a tie!") + elif player1 >= 100: + print("Player 1 wins!") + else: + print("Player 2 wins!") + +race()