diff --git a/RockPaperScissorsGame/arjungupta01/StonePaperScissors game/README.md b/RockPaperScissorsGame/arjungupta01/StonePaperScissors game/README.md new file mode 100644 index 000000000..a66899572 --- /dev/null +++ b/RockPaperScissorsGame/arjungupta01/StonePaperScissors game/README.md @@ -0,0 +1,36 @@ +# Stone Paper Scissors Game + +Description: + +This is a JavaScript project that allows users to play the popular game of Stone Paper Scissors online. The project uses HTML, CSS, and JavaScript to create a responsive and interactive game interface that can be played on desktop and mobile devices. + +## Features + +The main features of the project include: + +1. User-friendly interface with simple and intuitive game controls + +2. Single-player mode that allows users to play against the computer with varying levels of difficulty + +3. Real-time game feedback with scores and game status updates + +This project provides a fun and engaging way for users to play Stone Paper Scissors online. It is easy to set up and can be customized to suit individual preferences. Feel free to clone this repository and contribute to the development of the project. + +## How to play + +To play the game, follow these steps: + +1. Open the game page on your browser. + +2. Choose your move (stone, paper, or scissors). +3. Wait for the opponent (or computer) to choose their move. + 4.The winner is determined based on the game rules (stone beats scissors, paper beats stone, scissors beat paper). +4. The game continues until 5 moves. + +## Contributing + +We welcome contributions to this project. If you have any ideas or suggestions for new features, feel free to submit a pull request or create an issue. + +## Tech Stack + +**Server:** javascript diff --git a/RockPaperScissorsGame/arjungupta01/StonePaperScissors game/StonePaperScissor.js b/RockPaperScissorsGame/arjungupta01/StonePaperScissors game/StonePaperScissor.js new file mode 100644 index 000000000..961561bc6 --- /dev/null +++ b/RockPaperScissorsGame/arjungupta01/StonePaperScissors game/StonePaperScissor.js @@ -0,0 +1,44 @@ +console.log("------GAME ON-----") +console.log("\n ((Match of 5 Round's)) ") +console.log("\n**ENTER TYPE: Paper; Stone ; Scissor**") +let userScore=0 +let computerScore=0 +let i=0 +var arrStr = ['Stone','Paper','Scissor'] +while(i<5){ + +let user = prompt("*\nEnter your Move:") +var randElement = arrStr[Math.floor(Math.random() * 3)]; + +console.log("Computer's move: ",randElement); + +if(user==randElement){ + console.log("Draw") + userScore++ + computerScore++ + } + +else if(user=="Stone" && randElement=="Paper" || user=="Paper" && randElement=="Stone" || user=="Stone" && randElement=="Paper" || user=="Scissor" && randElement=="Paper" || user=="Stone" && randElement=="Scissor"){ + userScore++ +} + +else{ + computerScore++ +} + +console.log("\nUserSCore ",userScore," ComputerSCore ",computerScore) + +i++ +console.log("\n") +} + + +if(userScore>computerScore){ + console.log("RESULTS : Congratualtion!! You Won it!!") +} +else if(userScore