DEV Community

Cover image for Rock-Paper-Scissors Game
Satyam Krishna
Satyam Krishna

Posted on • Originally published at youtu.be

Rock-Paper-Scissors Game

Algorithm of this Game is:

1.There are three character: Rock, Paper and Scissors.
2.This game is multiplayer game.
3.The second player is computer and first player is user.
4.If player1-rock and player2-paper player2 is win and get 1point.
5.If player1-rock and player2-scissors player1 is win and get 1point.
6.If player1-rock and player2-rock match will Tie and no point.
7.If player1-paper and player2-rock player1 is win and get 1point.
9.If player1-paper and player2-scissors player2 is win and get 1point.
10.If player1-paper and player2-paper match will Tie and no point.
11.If player1-scissors and player2-rock player2 is win and get 1point.
12.If player1-scissors and player2-paper player1 is win and get 1point.
13.If player1-scissors and player2-scissors match will Tie and no point.
14.If player1 will score 10points first player1 is winner else vise versa.

Explanation:

1.Open python or any python IDE like Pycharm, Visual studio Code etc.
2.Create a file by .py extension.
3.Then import random module.
4.Initilize three variable count_rock, count_paper and
count_scissors.
5.Define a function update_count(userInput).
6.Define second function Predict().
7.Initilize two variable player_score and computer_score.
8.Define third function update_score(userInput).
9.Initilize one variable valid_entries.
10.Use while loop to iterate the game given condition.

You can see the video on YouTube the link is: https://youtu.be/qFJ4FQafTmQ

Source code of this game is on my GitHub you can check out:
https://github.com/satyam41/YouTube.git

Top comments (0)