From e415fa5d06bc0e6c6810c4d199184fd75af7ea4a Mon Sep 17 00:00:00 2001 From: SUDEEP M SHETTY <86517389+SUDEEP-M-SHETTY@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:12:11 +0000 Subject: [PATCH 1/2] Game is fully functional. --- app.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/app.py b/app.py index e69de29..ea6a6df 100644 --- a/app.py +++ b/app.py @@ -0,0 +1,53 @@ +import random + +def determine_winner(player_choice, computer_choice): + if player_choice == computer_choice: + return "Tie" + elif (player_choice == "rock" and computer_choice == "scissors") or \ + (player_choice == "scissors" and computer_choice == "paper") or \ + (player_choice == "paper" and computer_choice == "rock"): + return "Win" + else: + return "Lose" + +def print_result(result): + if result == "Win": + print("Congratulations! You won!") + elif result == "Lose": + print("Sorry! You lost.") + else: + print("It's a tie!") + +def main(): + player_score = 0 + rounds_played = 0 + + while True: + player_choice = input("Enter your choice (rock, paper, or scissors): ").lower() + if player_choice not in ["rock", "paper", "scissors"]: + print("Invalid option! Please choose from rock, paper, or scissors.") + continue + + computer_choice = random.choice(["rock", "paper", "scissors"]) + print("Computer chose:", computer_choice) + + result = determine_winner(player_choice, computer_choice) + print_result(result) + + if result == "Win": + player_score += 1 + elif result == "Lose": + player_score -= 1 + + rounds_played += 1 + + play_again = input("Do you want to play again? (yes/no): ").lower() + if play_again != "yes": + break + + print("Game over!") + print("Your final score:", player_score) + print("Total rounds played:", rounds_played) + +if __name__ == "__main__": + main() From ffb3ecfbfca699a0a291643137fa135058375687 Mon Sep 17 00:00:00 2001 From: SUDEEP M SHETTY <86517389+SUDEEP-M-SHETTY@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:27:28 +0000 Subject: [PATCH 2/2] Added few extensions in (devcontainer.json) --- .devcontainer/devcontainer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 74406e3..2e3e89e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,10 +16,13 @@ "extensions": [ "streetsidesoftware.code-spell-checker", "ms-python.python", - "ms-python.vscode-pylance" + "ms-python.vscode-pylance", + "GitHub.copilot" ] } }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [9000],