Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Projects/DICE GAME/images/dice1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Projects/DICE GAME/images/dice2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Projects/DICE GAME/images/dice3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Projects/DICE GAME/images/dice4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Projects/DICE GAME/images/dice5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Projects/DICE GAME/images/dice6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions Projects/DICE GAME/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="images/dice6.png">
<link rel="stylesheet" href="style.css">

<title>Dice Game</title>
</head>
<body>

<h2>DICE GAME</h2>
<hr size="5px">
<h1 class="ff">
Wins
</h1>
<div class="fir">
<h1>Player 1</h1>

</div>

<div class="sec">
<h1>Player 2</h1>

</div>
<div class="firim">
<img src="images/dice1.png" alt="1">

</div>
<div class="secim">
<img src="images/dice6.png" alt="1">

</div>
<script src="index.js" charset="UTF-8"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions Projects/DICE GAME/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var a= Math.random();
a= a*6;
var first = Math.floor(a)+1;
var so1= "images/dice"+first+".png";
var fin=document.querySelectorAll("img")[0];
fin.setAttribute("src",so1);

var b= Math.random();
b= b*6;
var second = Math.floor(b)+1;
var so2= "images/dice"+second+".png";
var fin2=document.querySelectorAll("img")[1];
fin2.setAttribute("src",so2);

if(first>second){
document.querySelectorAll("h1")[0].innerHTML="PLAYER 1 WINS";
}
else if(first<second){
document.querySelectorAll("h1")[0].innerHTML="PLAYER 2 WINS";
}
else{
document.querySelectorAll("h1")[0].innerHTML="TIES";
}
41 changes: 41 additions & 0 deletions Projects/DICE GAME/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
body{
background-color: yellow;

}
h2{
text-align: center;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
font-size: 300%;
}
.ff{
text-align: center;
font-family: fantasy;
font-size: 200%;
}
.fir{
font-style: italic;
position: relative;
left: 5cm;
display: inline-block;

}
.sec{
font-style: italic;

position: absolute;
left: 25cm;
top:5.4cm;
display: inline-block;
}
.firim{
position: relative;
left: 4cm;

}

.secim{
position: absolute;
left: 23cm;
top:7.5cm;

}