├── dcg.png ├── .DS_Store ├── dice1.png ├── dice2.png ├── dice3.png ├── dice4.png ├── dice5.png ├── dice6.png ├── indes.js ├── README.md ├── index.html └── styles.css /dcg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dcg.png -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/.DS_Store -------------------------------------------------------------------------------- /dice1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dice1.png -------------------------------------------------------------------------------- /dice2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dice2.png -------------------------------------------------------------------------------- /dice3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dice3.png -------------------------------------------------------------------------------- /dice4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dice4.png -------------------------------------------------------------------------------- /dice5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dice5.png -------------------------------------------------------------------------------- /dice6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahekar001aditya/Dice_Game/HEAD/dice6.png -------------------------------------------------------------------------------- /indes.js: -------------------------------------------------------------------------------- 1 | var randNum = Math.floor(Math.random()*6)+1; 2 | var randomDice ="dice" + randNum + ".png"; 3 | var imgg1 = document.querySelectorAll("img")[0]; 4 | imgg1.setAttribute("src",randomDice); 5 | 6 | var randNum2= Math.floor(Math.random()*6)+1; 7 | var randomDice2="dice" + randNum2+ ".png"; 8 | var imgg2 = document.querySelectorAll("img")[1]; 9 | imgg2.setAttribute("src",randomDice2); 10 | 11 | if(randNum > randNum2){ 12 | document.querySelector("h1").innerHTML = "Player 1 Wins"; 13 | } 14 | else if(randNum2 > randNum){ 15 | document.querySelector("h1").innerHTML = "Player 2 Wins"; 16 | } 17 | else{ 18 | document.querySelector("h1").innerHTML = "Match Draw!"; 19 | 20 | } 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🎲 Dice Game 2 | 3 | A fun and interactive **Dice Game** built using HTML, CSS, and JavaScript. 4 | The game simulates a two-player dice roll and displays the winner dynamically with visuals. 5 | 6 | --- 7 | 8 | ## 🌐 Live Demo 9 | 🔗 [Dice Game](https://adityamahekar.github.io/Dice_Game/) 10 | 11 | --- 12 | 13 | ## 🚀 Features 14 | - 🎲 Simulates rolling two dice 15 | - 👥 Two-player mode 16 | - 🖼️ Dice images change based on random outcome 17 | - ⚡ Fast and responsive interactions 18 | - 🧠 Simple logic with randomization 19 | 20 | --- 21 | 22 | ## 🛠️ Tech Stack 23 | - **Frontend**: HTML, CSS, JavaScript 24 | - **Deployment**: GitHub Pages 25 | 26 | --- 27 | 28 | ## 📷 Gallery 29 | 30 | | Dice Game UI | 31 | |--------------| 32 | | ![Dice Game Screenshot](dcg.png) | 33 | 34 | --- 35 | 36 | 37 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dicee 6 | 7 | 11 | 12 | 13 |
14 |

Start Game

15 |

Refresh Me

16 | 17 |
18 |

Player 1

19 | 20 |
21 | 22 |
23 |

Player 2

24 | 25 |
26 |
27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | .container { 2 | width: 70%; 3 | margin: auto; 4 | text-align: center; 5 | } 6 | 7 | .dice { 8 | text-align: center; 9 | display: inline-block; 10 | 11 | } 12 | 13 | body { 14 | background-color: #2764e7; 15 | } 16 | 17 | h1 { 18 | margin: 30px; 19 | font-family: 'Lobster', cursive; 20 | text-shadow: 5px 0 #232931; 21 | font-size: 8rem; 22 | color: #09ffad; 23 | } 24 | h2{ 25 | margin: 30px; 26 | font-family: 'Lobster', cursive; 27 | text-shadow: 5px 0 #232931; 28 | font-size:4rem; 29 | color: #cf1111; 30 | } 31 | p { 32 | font-size: 2rem; 33 | color: #00ffea; 34 | font-family: 'Indie Flower', cursive; 35 | } 36 | 37 | img { 38 | width: 80%; 39 | } 40 | 41 | footer { 42 | margin-top: 5%; 43 | color: #EEEEEE; 44 | text-align: center; 45 | font-family: 'Indie Flower', cursive; 46 | 47 | } 48 | --------------------------------------------------------------------------------