diff --git a/30DaysOfJavaScript/assets/37.png b/30DaysOfJavaScript/assets/37.png new file mode 100644 index 00000000..b1146ad1 Binary files /dev/null and b/30DaysOfJavaScript/assets/37.png differ diff --git a/37 - RPS Game/assets/images1.png b/37 - RPS Game/assets/images1.png new file mode 100644 index 00000000..ed840221 Binary files /dev/null and b/37 - RPS Game/assets/images1.png differ diff --git a/37 - RPS Game/assets/images2.png b/37 - RPS Game/assets/images2.png new file mode 100644 index 00000000..eedc73d0 Binary files /dev/null and b/37 - RPS Game/assets/images2.png differ diff --git a/37 - RPS Game/assets/images3.png b/37 - RPS Game/assets/images3.png new file mode 100644 index 00000000..11118708 Binary files /dev/null and b/37 - RPS Game/assets/images3.png differ diff --git a/37 - RPS Game/fonts/sans.ttf b/37 - RPS Game/fonts/sans.ttf new file mode 100644 index 00000000..85860e6c Binary files /dev/null and b/37 - RPS Game/fonts/sans.ttf differ diff --git a/37 - RPS Game/start.html b/37 - RPS Game/start.html new file mode 100644 index 00000000..159d3a7f --- /dev/null +++ b/37 - RPS Game/start.html @@ -0,0 +1,28 @@ + + + + + + + Document + + + + +
+
+

Stone Paper Scissors Game


+ Rock + Paper + Scissors +
+ +
+ +
+ +
+ + \ No newline at end of file diff --git a/37 - RPS Game/start.js b/37 - RPS Game/start.js new file mode 100644 index 00000000..502ae23d --- /dev/null +++ b/37 - RPS Game/start.js @@ -0,0 +1,53 @@ +function rpsGame(humanChoice) { + + let myChoice = number(humanChoice); + let comChoice = random(); + + let final=result(myChoice,comChoice); + + + document.getElementById("message").innerHTML=`Human choice is ${str(myChoice)} and Computer choice is ${str(comChoice)}
${final}`; + +} + +function random() { + return Math.floor(Math.random() * 3); +} + +function number(word) { + if (word == "Rock") { + return 0; + } + else if (word == "Paper") { + return 1; + } + else if (word == "Scissors") { + return 2; + } +} + +function str(number) { + if (number == 0) { + return "Rock"; + } + else if (number == 1) { + return "Paper"; + } + else if (number == 2) { + return "Scissors"; + } +} + +function result(myChoice, comChoice) { + if (myChoice == comChoice) { + return "Tied"; + } + else { + if ((comChoice == 0 && myChoice == 1)|| (comChoice ==1 && myChoice ==2) || (comChoice ==2 && myChoice ==0)) { + return "You won"; + } + else if ((comChoice == 1 && myChoice == 0)|| (comChoice ==2 && myChoice ==1) || (comChoice ==0 && myChoice ==2)) { + return "Computer won"; + } + } +} \ No newline at end of file diff --git a/37 - RPS Game/style.css b/37 - RPS Game/style.css new file mode 100644 index 00000000..51fa01a2 --- /dev/null +++ b/37 - RPS Game/style.css @@ -0,0 +1,42 @@ +body{ + background-color: #19172e; + font-family: 'sans'; +} + +h2 +{ + font-style: oblique; + color: #fff; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + text-align: center; + font-size: 40px; + padding: 0%; +} + +img:hover +{ + box-shadow: rgb(95, 9, 26) 10px 10px 10px; +} + +img +{ + box-shadow: crimson -10px -10px 10px; + margin: 40px; +} + +.container +{ + max-width: 700px; + align-items: center; + justify-content: center; + margin: auto; + display: flex; + border: 5px solid #fff; + padding: 10px; +} +#message{ + text-align: center; + font-size: 50px; + + color: #fff; +} \ No newline at end of file diff --git a/index.html b/index.html index effa41b2..ef9e55b4 100644 --- a/index.html +++ b/index.html @@ -257,6 +257,14 @@

Hangman

Hangman + +
+ +

Rock Paper Scissors Game

+ Rock Paper Scissors Game +
+
+