From bba08afd34cd4dca82b3a1426df4bce32f09c2f9 Mon Sep 17 00:00:00 2001 From: Sauvic Date: Tue, 6 Oct 2020 00:04:50 +0530 Subject: [PATCH 1/2] Basic Game of Rock-Paper-Scissors --- game.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 game.py diff --git a/game.py b/game.py new file mode 100644 index 0000000000..824cdf4730 --- /dev/null +++ b/game.py @@ -0,0 +1,57 @@ +# Simple Game of Rock, Paper, Scissors... + +from random import randint +player_wins = 0 +AI_wins = 0 + +print("Hello Player!") +win_score = int(input("Enter the winning score (e.g. 3): ")) + +while player_wins < win_score and AI_wins < win_score: + print(f"Your Score: {player_wins} AI Score: {AI_wins}") + + player = input("\n(Choose Rock, Paper or Scissors...or Enter q to exit...): ").lower() + if player == "quit" or player == "q": + break + random_num = randint(0, 2) + if (random_num == 0): + computer = "rock" + elif (random_num == 1): + computer = "paper" + else: + computer = "scissors" + + print(f"The AI plays: {computer}") + + if player == computer: + print("It's a tie!") + elif player == "rock": + if computer == "paper": + print("AI wins!") + AI_wins += 1 + else: + print("YOU win!") + player_wins += 1 + elif player == "paper": + if computer == "rock": + print("YOU win!") + player_wins += 1 + else: + print("AI wins!") + AI_wins += 1 + elif (player == "scissors"): + if (computer == "rock"): + print("AI wins!") + AI_wins += 1 + else: + print("You win!") + player_wins += 1 + else: + print("Invalid Entry!") + +if player_wins > AI_wins: + print("CONGRATS, YOU BEAT THE AI!") +elif player_wins == AI_wins: + print("YOU'VE MADE FRIENDS WITH THE AI!") +else: + print("YOU LOST AGAINST THE AI! Prepare for World Domination :(") From f4e2a410b6b3c04c7c5649d203d25b56241c791f Mon Sep 17 00:00:00 2001 From: Sauvic Date: Tue, 6 Oct 2020 00:11:21 +0530 Subject: [PATCH 2/2] Update Contributors.html --- Contributors.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Contributors.html b/Contributors.html index 417fa7d5c1..e1e84679e4 100644 --- a/Contributors.html +++ b/Contributors.html @@ -134,7 +134,8 @@

Contributors

Milos Vujinic Sayan Das Shagufta Iqbal -Ishant Garg +Ishant Garg +Sauvic P Choudhury