Hello to all brilliant peoples of the community. I recently started studying python programming language and tried creating a simple game of Stone paper Scissors. We all have played the game of Stone Paper Scissors in our childhood. Stone paper scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "Stone" (a closed fist), "paper" (a flat hand), and "scissors" (a fist with the index finger and middle finger extended,).
Image Source
I tried to implement the logic of the game programmatically. In this simple python program one can play the game with computer. It's simple yet enjoyable.
The number 1 is for stone, 2 is for Paper and 3 is for Scissors.
The Computer chose it's move randomly. Its a tie if both the player and computer have the same choice and gains the value of 1 if anyone wins.
The game goes on till anyone of the player or computer have 5 points. Whoever scores 5 points earlier will win. Then one can chose to play again or exit.
It's not a complex game but really interesting to build it. The snapshot of the source code of the program are as follows.
The program contains 100 lines of code and was created on IDLE. I know it can be optimized but I am just beginning to learn python so it's a startπππππ. If you guys have any suggestions to improve the code feel free to comment. Thank you all, have a great life. This is signing off....