Skip to content

Commit 3119687

Browse files
authored
Merge pull request #665 from arjungupta01/master
stonePaperScissor
2 parents de19617 + b5d9125 commit 3119687

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Stone Paper Scissors Game
2+
3+
Description:
4+
5+
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.
6+
7+
## Features
8+
9+
The main features of the project include:
10+
11+
1. User-friendly interface with simple and intuitive game controls
12+
13+
2. Single-player mode that allows users to play against the computer with varying levels of difficulty
14+
15+
3. Real-time game feedback with scores and game status updates
16+
17+
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.
18+
19+
## How to play
20+
21+
To play the game, follow these steps:
22+
23+
1. Open the game page on your browser.
24+
25+
2. Choose your move (stone, paper, or scissors).
26+
3. Wait for the opponent (or computer) to choose their move.
27+
4.The winner is determined based on the game rules (stone beats scissors, paper beats stone, scissors beat paper).
28+
4. The game continues until 5 moves.
29+
30+
## Contributing
31+
32+
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.
33+
34+
## Tech Stack
35+
36+
**Server:** javascript
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
console.log("------GAME ON-----")
2+
console.log("\n ((Match of 5 Round's)) ")
3+
console.log("\n**ENTER TYPE: Paper; Stone ; Scissor**")
4+
let userScore=0
5+
let computerScore=0
6+
let i=0
7+
var arrStr = ['Stone','Paper','Scissor']
8+
while(i<5){
9+
10+
let user = prompt("*\nEnter your Move:")
11+
var randElement = arrStr[Math.floor(Math.random() * 3)];
12+
13+
console.log("Computer's move: ",randElement);
14+
15+
if(user==randElement){
16+
console.log("Draw")
17+
userScore++
18+
computerScore++
19+
}
20+
21+
else if(user=="Stone" && randElement=="Paper" || user=="Paper" && randElement=="Stone" || user=="Stone" && randElement=="Paper" || user=="Scissor" && randElement=="Paper" || user=="Stone" && randElement=="Scissor"){
22+
userScore++
23+
}
24+
25+
else{
26+
computerScore++
27+
}
28+
29+
console.log("\nUserSCore ",userScore," ComputerSCore ",computerScore)
30+
31+
i++
32+
console.log("\n")
33+
}
34+
35+
36+
if(userScore>computerScore){
37+
console.log("RESULTS : Congratualtion!! You Won it!!")
38+
}
39+
else if(userScore<computerScore){
40+
console.log("RESULTS : Sorry!!! You Lost it!!")
41+
}
42+
else{
43+
console.log("RESULTS : ----It's a Draw----")
44+
}

0 commit comments

Comments
 (0)