diff --git a/CODE AVATARS/README.md b/CODE AVATARS/README.md new file mode 100644 index 000000000..f1a464e11 --- /dev/null +++ b/CODE AVATARS/README.md @@ -0,0 +1,36 @@ +# Project Name - Dice Game +# Issue No - #20 +# Project Description +Build a dice-rolling game. A group of people initially (invite only) will join in, guess a number from the range +[1, 6], and then put a bet upon their guess. The one who guesses the output correctly is treated as the +winner(s). Then the entire pool of bets automatically gets distributed across these winner(s). The main +challenge here is to generate a perfectly random number in the given range (of course on-chain) so as to +avoid any misleads. Once this is achieved, a complete section of games can be further built upon this +random module. + +# Problem trying to Solve +The Problem is to develop an interactive dice game . And to provide engaging audio experience while pressing the key buttons Audio API is used for the functionality + +Randomized set of combinations of dice is achieved through random() function of js which will be the backbone for the project +interactive audio api is used on clicking game button to generate sound and responsive user interface is used for buttons + +# Tech Stack +[![skills](https://skillicons.dev/icons?i=html,css,js&perline=5)](https://skillicons.dev) + +# Project Photo + +image + +# To view the website + +https://trioyjk.github.io/DiceGame/ + +# PPT link + +[Click here to view ](https://github.com/Yasaswini25/DiceGame/blob/312b3e90c711b84c56e6df1a86a7a8fea6df2808/wepik-rolling-the-dice-exploring-the-exciting-world-of-web-development-dice-game-2023082315141268dz.pdf) + +# Contributors + +[![](https://github.com/Yasaswini25.png?size=50)](https://github.com/Yasaswini25) [![](https://github.com/JayanthReddyG.png?size=50)](https://github.com/JayanthReddyG) [![](https://github.com/komalreddy3.png?size=50)](https://github.com/komalreddy3) + + diff --git a/CODE AVATARS/bg.jpg b/CODE AVATARS/bg.jpg new file mode 100644 index 000000000..f93be4aba Binary files /dev/null and b/CODE AVATARS/bg.jpg differ diff --git a/CODE AVATARS/d1.png b/CODE AVATARS/d1.png new file mode 100644 index 000000000..bf6f73177 Binary files /dev/null and b/CODE AVATARS/d1.png differ diff --git a/CODE AVATARS/d2.png b/CODE AVATARS/d2.png new file mode 100644 index 000000000..0e8ec10f1 Binary files /dev/null and b/CODE AVATARS/d2.png differ diff --git a/CODE AVATARS/d3.png b/CODE AVATARS/d3.png new file mode 100644 index 000000000..4469b4d7d Binary files /dev/null and b/CODE AVATARS/d3.png differ diff --git a/CODE AVATARS/d4.png b/CODE AVATARS/d4.png new file mode 100644 index 000000000..6b5753ddc Binary files /dev/null and b/CODE AVATARS/d4.png differ diff --git a/CODE AVATARS/d5.png b/CODE AVATARS/d5.png new file mode 100644 index 000000000..469668ea4 Binary files /dev/null and b/CODE AVATARS/d5.png differ diff --git a/CODE AVATARS/d6.png b/CODE AVATARS/d6.png new file mode 100644 index 000000000..d43971ea0 Binary files /dev/null and b/CODE AVATARS/d6.png differ diff --git a/CODE AVATARS/del b/CODE AVATARS/del new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/CODE AVATARS/del @@ -0,0 +1 @@ + diff --git a/CODE AVATARS/diceroll.gif b/CODE AVATARS/diceroll.gif new file mode 100644 index 000000000..0be6e41e3 Binary files /dev/null and b/CODE AVATARS/diceroll.gif differ diff --git a/CODE AVATARS/index.html b/CODE AVATARS/index.html new file mode 100644 index 000000000..035c3bed7 --- /dev/null +++ b/CODE AVATARS/index.html @@ -0,0 +1,45 @@ + + + + + + + + + Dice Game + + + +
+

Let's Begin

+
+
+

Player1

+ dice 6 +
+
+

Player2

+ dice 6 +
+
+
+
+
+ +
+
+ +
+
+ + + + + + diff --git a/CODE AVATARS/rolldice.mp3 b/CODE AVATARS/rolldice.mp3 new file mode 100644 index 000000000..3316b125e Binary files /dev/null and b/CODE AVATARS/rolldice.mp3 differ diff --git a/CODE AVATARS/script.js b/CODE AVATARS/script.js new file mode 100644 index 000000000..d8f330ec5 --- /dev/null +++ b/CODE AVATARS/script.js @@ -0,0 +1,61 @@ +// CONTRIBUTORS + +// JNANA YASASWINI + +// G JAYANTH REDDY + +// KOMAL REDDY K + + +let player1 = "Player1"; +let player2 = "Player2"; +function changenames() { + player1 = prompt("change player1 name"); + player2 = prompt("change player2 name"); + if (player1.length < 1 || player2.length < 1) { + alert("please enter a valid name"); + return; + } + document.querySelector("p.Player1").innerHTML = player1; + document.querySelector("p.Player2").innerHTML = player2; +} +function begin() { + let r = document.querySelector("h1"); + let utterance = new SpeechSynthesisUtterance(`${r.innerText}`); + speechSynthesis.speak(utterance); +} +function rollthedice() { + let diceNum1 = document.querySelector(".img1"); + let diceNum2 = document.querySelector(".img2"); + + diceNum1.setAttribute("src", "./diceroll.gif"); + diceNum2.setAttribute("src", "./diceroll.gif"); + audio = new Audio("./rolldice.mp3"); + audio.play(); + + let result = document.querySelector("h1"); + setTimeout(() => { + let randomNumber1 = Math.floor(Math.random() * 6) + 1; + let randomNumber2 = Math.floor(Math.random() * 6) + 1; + + diceNum1.setAttribute("src", "./d" + randomNumber1 + ".png"); + diceNum2.setAttribute("src", "./d" + randomNumber2 + ".png"); + + if (randomNumber1 == randomNumber2) { + result.innerHTML = "TIE"; + } else if (randomNumber1 < randomNumber2) { + result.innerHTML = player2 + " Won"; + } else { + result.innerHTML = player1 + " Won"; + } + let speakout = new SpeechSynthesisUtterance(`${result.innerText}`); + speechSynthesis.speak(speakout); + audio = new Audio("./success.mp3"); + audio.play(); + let speakout1 = new SpeechSynthesisUtterance(`Lets Begin`); + speechSynthesis.speak(speakout1); + setTimeout(() => { + result.innerHTML = "Let's Begin"; + }, 1000); + }, 2500); +} diff --git a/CODE AVATARS/style.css b/CODE AVATARS/style.css new file mode 100644 index 000000000..6c011147e --- /dev/null +++ b/CODE AVATARS/style.css @@ -0,0 +1,58 @@ +/* CONTRIBUTORS + +JNANA YASASWINI + +G JAYANTH REDDY + +KOMAL REDDY K */ + + +*{ + margin: 0; + padding : 0; + font-family: 'Times New Roman', Times, serif; + box-sizing:border-box; +} +body{ + background-image: url("./bg.jpg"); + width: 100%; + height: 100%; + padding: 5rem; + align-items: center; + padding-bottom: 200px; + justify-content: center; + background-repeat: no-repeat; + background-position: right; + background-size:800px 840px; + /* background-color: rgba(219, 246, 228, 0.936);*/ + +} +h1{ + font-size: 32px; + text-align: center; + font-weight: 1000; + } +.dice,.container-bottom{ + width: 250px; + padding: 30px; + + border-radius: 5px; +} +.wrapper{ + display: flex; +} +.btn{ + background-color: #0f3b8df2;; + color: rgb(255, 250, 250); + border-radius: 5px; + font-size: 19px; + padding: 10px 30px 10px 30px; + cursor: pointer; +} +.img1,.img2{ + padding-top: 25px; +} +.Player1,.Player2{ + font-size: 32px; + text-align: left; +} \ No newline at end of file diff --git a/CODE AVATARS/success.mp3 b/CODE AVATARS/success.mp3 new file mode 100644 index 000000000..de51d68b3 Binary files /dev/null and b/CODE AVATARS/success.mp3 differ