diff --git a/BJ.html b/BJ.html
new file mode 100644
index 0000000..eb390cb
--- /dev/null
+++ b/BJ.html
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+ casino 77
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 7
+
+ 7
+
+ 7
+
+
+ BLACK JACK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Index.html b/Index.html
index eef4650..e9078c8 100644
--- a/Index.html
+++ b/Index.html
@@ -32,7 +32,9 @@
+
+
diff --git a/J-B.png b/J-B.png
new file mode 100644
index 0000000..000b640
Binary files /dev/null and b/J-B.png differ
diff --git a/J-C.png b/J-C.png
new file mode 100644
index 0000000..5e003be
Binary files /dev/null and b/J-C.png differ
diff --git a/J-D.png b/J-D.png
new file mode 100644
index 0000000..131a977
Binary files /dev/null and b/J-D.png differ
diff --git a/J-H.png b/J-H.png
new file mode 100644
index 0000000..bf342bc
Binary files /dev/null and b/J-H.png differ
diff --git a/J-R.png b/J-R.png
new file mode 100644
index 0000000..55b3ef9
Binary files /dev/null and b/J-R.png differ
diff --git a/J-S.png b/J-S.png
new file mode 100644
index 0000000..f539c19
Binary files /dev/null and b/J-S.png differ
diff --git a/K-C.png b/K-C.png
new file mode 100644
index 0000000..68e5774
Binary files /dev/null and b/K-C.png differ
diff --git a/K-D.png b/K-D.png
new file mode 100644
index 0000000..e21d6a0
Binary files /dev/null and b/K-D.png differ
diff --git a/K-H.png b/K-H.png
new file mode 100644
index 0000000..1d3c468
Binary files /dev/null and b/K-H.png differ
diff --git a/K-S.png b/K-S.png
new file mode 100644
index 0000000..2edbbc1
Binary files /dev/null and b/K-S.png differ
diff --git a/Q-C.png b/Q-C.png
new file mode 100644
index 0000000..7be5f9a
Binary files /dev/null and b/Q-C.png differ
diff --git a/Q-D.png b/Q-D.png
new file mode 100644
index 0000000..928f650
Binary files /dev/null and b/Q-D.png differ
diff --git a/Q-H.png b/Q-H.png
new file mode 100644
index 0000000..21839e6
Binary files /dev/null and b/Q-H.png differ
diff --git a/Q-S.png b/Q-S.png
new file mode 100644
index 0000000..7983d03
Binary files /dev/null and b/Q-S.png differ
diff --git a/bj.js b/bj.js
new file mode 100644
index 0000000..8330e03
--- /dev/null
+++ b/bj.js
@@ -0,0 +1,151 @@
+var dealerSum = 0;
+var yourSum = 0;
+
+var dealerAceCount = 0;
+var yourAceCount = 0;
+
+var hidden;
+var deck;
+
+var canHit = true;
+
+window.onload = function() {
+ buildDeck();
+ shuffleDeck();
+ startGame();
+}
+
+function buildDeck() {
+ let values = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"];
+ let types = ["C", "D", "H", "S"];
+ deck = [];
+
+ for (let i = 0; i < types.length; i++) {
+ for (let j = 0; j < values.length; j++) {
+ deck.push(values[j] + "-" + types[i]);
+ }
+ }
+ // console.log(deck);
+}
+
+function shuffleDeck() {
+ for (let i = 0; i < deck.length; i++) {
+ let j = Math.floor(Math.random() * deck.length);
+ let temp = deck[i];
+ deck[i] = deck[j];
+ deck[j] = temp;
+ }
+ console.log(deck);
+}
+
+function startGame() {
+ hidden = deck.pop();
+ dealerSum += getValue(hidden);
+ dealerAceCount += checkAce(hidden);
+ // console.log(hidden);
+ // console.log(dealerSum);
+ while (dealerSum < 17) {
+ //
+ let cardImg = document.createElement("img");
+ let card = deck.pop();
+ cardImg.src = "./cards/" + card + ".png";
+ dealerSum += getValue(card);
+ dealerAceCount += checkAce(card);
+ document.getElementById("dealer-cards").append(cardImg);
+ }
+ console.log(dealerSum);
+
+ for (let i = 0; i < 2; i++) {
+ let cardImg = document.createElement("img");
+ let card = deck.pop();
+ cardImg.src = "./cards/" + card + ".png";
+ yourSum += getValue(card);
+ yourAceCount += checkAce(card);
+ document.getElementById("your-cards").append(cardImg);
+ }
+
+ console.log(yourSum);
+ document.getElementById("hit").addEventListener("click", hit);
+ document.getElementById("stay").addEventListener("click", stay);
+
+}
+
+function hit() {
+ if (!canHit) {
+ return;
+ }
+
+ let cardImg = document.createElement("img");
+ let card = deck.pop();
+ cardImg.src = "./cards/" + card + ".png";
+ yourSum += getValue(card);
+ yourAceCount += checkAce(card);
+ document.getElementById("your-cards").append(cardImg);
+
+ if (reduceAce(yourSum, yourAceCount) > 21) {
+ canHit = false;
+ }
+
+}
+
+function stay() {
+ dealerSum = reduceAce(dealerSum, dealerAceCount);
+ yourSum = reduceAce(yourSum, yourAceCount);
+
+ canHit = false;
+ document.getElementById("hidden").src = "./cards/" + hidden + ".png";
+
+ let message = "";
+ if (yourSum > 21) {
+ message = "Tu as perdu!";
+ }
+ else if (dealerSum > 21) {
+ message = "Tu as gagné!";
+ }
+ //both you and dealer <= 21
+ else if (yourSum == dealerSum) {
+ message = "Egalite!";
+ }
+ else if (yourSum > dealerSum) {
+ message = "Tu as gagné!";
+ }
+ else if (yourSum < dealerSum) {
+ message = "Tu as perdu!";
+ }
+
+ document.getElementById("dealer-sum").innerText = dealerSum;
+ document.getElementById("your-sum").innerText = yourSum;
+ document.getElementById("results").innerText = message;
+}
+
+function getValue(card) {
+ let data = card.split("-"); // "4-C" -> ["4", "C"]
+ let value = data[0];
+
+ if (isNaN(value)) { //A J Q K
+ if (value == "A") {
+ return 11;
+ }
+ return 10;
+ }
+ return parseInt(value);
+}
+
+function checkAce(card) {
+ if (card[0] == "A") {
+ return 1;
+ }
+ return 0;
+}
+
+function reduceAce(playerSum, playerAceCount) {
+ while (playerSum > 21 && playerAceCount > 0) {
+ playerSum -= 10;
+ playerAceCount -= 1;
+ }
+ return playerSum;
+}
+
+var refresh = window.getElementById('refresh');
+refresh.addEventListener('click', location.reload(), false);
+
diff --git a/cards/10-C.png b/cards/10-C.png
new file mode 100644
index 0000000..18af741
Binary files /dev/null and b/cards/10-C.png differ
diff --git a/cards/10-D.png b/cards/10-D.png
new file mode 100644
index 0000000..3bbc4e0
Binary files /dev/null and b/cards/10-D.png differ
diff --git a/cards/10-H.png b/cards/10-H.png
new file mode 100644
index 0000000..3eb83d7
Binary files /dev/null and b/cards/10-H.png differ
diff --git a/cards/10-S.png b/cards/10-S.png
new file mode 100644
index 0000000..0b3d294
Binary files /dev/null and b/cards/10-S.png differ
diff --git a/cards/2-C.png b/cards/2-C.png
new file mode 100644
index 0000000..291ed97
Binary files /dev/null and b/cards/2-C.png differ
diff --git a/cards/2-D.png b/cards/2-D.png
new file mode 100644
index 0000000..4deee7c
Binary files /dev/null and b/cards/2-D.png differ
diff --git a/cards/2-H.png b/cards/2-H.png
new file mode 100644
index 0000000..75a014f
Binary files /dev/null and b/cards/2-H.png differ
diff --git a/cards/2-S.png b/cards/2-S.png
new file mode 100644
index 0000000..1ce0ffe
Binary files /dev/null and b/cards/2-S.png differ
diff --git a/cards/3-C.png b/cards/3-C.png
new file mode 100644
index 0000000..076ab31
Binary files /dev/null and b/cards/3-C.png differ
diff --git a/cards/3-D.png b/cards/3-D.png
new file mode 100644
index 0000000..8ee0b4b
Binary files /dev/null and b/cards/3-D.png differ
diff --git a/cards/3-H.png b/cards/3-H.png
new file mode 100644
index 0000000..8e74673
Binary files /dev/null and b/cards/3-H.png differ
diff --git a/cards/3-S.png b/cards/3-S.png
new file mode 100644
index 0000000..f9e06b4
Binary files /dev/null and b/cards/3-S.png differ
diff --git a/cards/4-C.png b/cards/4-C.png
new file mode 100644
index 0000000..8be9e08
Binary files /dev/null and b/cards/4-C.png differ
diff --git a/cards/4-D.png b/cards/4-D.png
new file mode 100644
index 0000000..70e82e8
Binary files /dev/null and b/cards/4-D.png differ
diff --git a/cards/4-H.png b/cards/4-H.png
new file mode 100644
index 0000000..ceecbfe
Binary files /dev/null and b/cards/4-H.png differ
diff --git a/cards/4-S.png b/cards/4-S.png
new file mode 100644
index 0000000..95abe3e
Binary files /dev/null and b/cards/4-S.png differ
diff --git a/cards/5-C.png b/cards/5-C.png
new file mode 100644
index 0000000..bde9777
Binary files /dev/null and b/cards/5-C.png differ
diff --git a/cards/5-D.png b/cards/5-D.png
new file mode 100644
index 0000000..bb92525
Binary files /dev/null and b/cards/5-D.png differ
diff --git a/cards/5-H.png b/cards/5-H.png
new file mode 100644
index 0000000..d923456
Binary files /dev/null and b/cards/5-H.png differ
diff --git a/cards/5-S.png b/cards/5-S.png
new file mode 100644
index 0000000..53a1aad
Binary files /dev/null and b/cards/5-S.png differ
diff --git a/cards/6-C.png b/cards/6-C.png
new file mode 100644
index 0000000..a9660a0
Binary files /dev/null and b/cards/6-C.png differ
diff --git a/cards/6-D.png b/cards/6-D.png
new file mode 100644
index 0000000..78a80ad
Binary files /dev/null and b/cards/6-D.png differ
diff --git a/cards/6-H.png b/cards/6-H.png
new file mode 100644
index 0000000..361643e
Binary files /dev/null and b/cards/6-H.png differ
diff --git a/cards/6-S.png b/cards/6-S.png
new file mode 100644
index 0000000..40242a7
Binary files /dev/null and b/cards/6-S.png differ
diff --git a/cards/7-C.png b/cards/7-C.png
new file mode 100644
index 0000000..9d6b545
Binary files /dev/null and b/cards/7-C.png differ
diff --git a/cards/7-D.png b/cards/7-D.png
new file mode 100644
index 0000000..6ad5f15
Binary files /dev/null and b/cards/7-D.png differ
diff --git a/cards/7-H.png b/cards/7-H.png
new file mode 100644
index 0000000..19b89a2
Binary files /dev/null and b/cards/7-H.png differ
diff --git a/cards/7-S.png b/cards/7-S.png
new file mode 100644
index 0000000..b9f1b93
Binary files /dev/null and b/cards/7-S.png differ
diff --git a/cards/8-C.png b/cards/8-C.png
new file mode 100644
index 0000000..cec743c
Binary files /dev/null and b/cards/8-C.png differ
diff --git a/cards/8-D.png b/cards/8-D.png
new file mode 100644
index 0000000..ed12951
Binary files /dev/null and b/cards/8-D.png differ
diff --git a/cards/8-H.png b/cards/8-H.png
new file mode 100644
index 0000000..fb39723
Binary files /dev/null and b/cards/8-H.png differ
diff --git a/cards/8-S.png b/cards/8-S.png
new file mode 100644
index 0000000..b6b3b38
Binary files /dev/null and b/cards/8-S.png differ
diff --git a/cards/9-C.png b/cards/9-C.png
new file mode 100644
index 0000000..2174db5
Binary files /dev/null and b/cards/9-C.png differ
diff --git a/cards/9-D.png b/cards/9-D.png
new file mode 100644
index 0000000..0b933fb
Binary files /dev/null and b/cards/9-D.png differ
diff --git a/cards/9-H.png b/cards/9-H.png
new file mode 100644
index 0000000..7b196d6
Binary files /dev/null and b/cards/9-H.png differ
diff --git a/cards/9-S.png b/cards/9-S.png
new file mode 100644
index 0000000..3c3b5ff
Binary files /dev/null and b/cards/9-S.png differ
diff --git a/cards/A-C.png b/cards/A-C.png
new file mode 100644
index 0000000..42bf5ec
Binary files /dev/null and b/cards/A-C.png differ
diff --git a/cards/A-D.png b/cards/A-D.png
new file mode 100644
index 0000000..79cd3b8
Binary files /dev/null and b/cards/A-D.png differ
diff --git a/cards/A-H.png b/cards/A-H.png
new file mode 100644
index 0000000..b422124
Binary files /dev/null and b/cards/A-H.png differ
diff --git a/cards/A-S.png b/cards/A-S.png
new file mode 100644
index 0000000..103f56d
Binary files /dev/null and b/cards/A-S.png differ
diff --git a/cards/BACK.png b/cards/BACK.png
new file mode 100644
index 0000000..2e02e05
Binary files /dev/null and b/cards/BACK.png differ
diff --git a/cards/J-B.png b/cards/J-B.png
new file mode 100644
index 0000000..000b640
Binary files /dev/null and b/cards/J-B.png differ
diff --git a/cards/J-C.png b/cards/J-C.png
new file mode 100644
index 0000000..5e003be
Binary files /dev/null and b/cards/J-C.png differ
diff --git a/cards/J-D.png b/cards/J-D.png
new file mode 100644
index 0000000..131a977
Binary files /dev/null and b/cards/J-D.png differ
diff --git a/cards/J-H.png b/cards/J-H.png
new file mode 100644
index 0000000..bf342bc
Binary files /dev/null and b/cards/J-H.png differ
diff --git a/cards/J-R.png b/cards/J-R.png
new file mode 100644
index 0000000..55b3ef9
Binary files /dev/null and b/cards/J-R.png differ
diff --git a/cards/J-S.png b/cards/J-S.png
new file mode 100644
index 0000000..f539c19
Binary files /dev/null and b/cards/J-S.png differ
diff --git a/cards/K-C.png b/cards/K-C.png
new file mode 100644
index 0000000..68e5774
Binary files /dev/null and b/cards/K-C.png differ
diff --git a/cards/K-D.png b/cards/K-D.png
new file mode 100644
index 0000000..e21d6a0
Binary files /dev/null and b/cards/K-D.png differ
diff --git a/cards/K-H.png b/cards/K-H.png
new file mode 100644
index 0000000..1d3c468
Binary files /dev/null and b/cards/K-H.png differ
diff --git a/cards/K-S.png b/cards/K-S.png
new file mode 100644
index 0000000..2edbbc1
Binary files /dev/null and b/cards/K-S.png differ
diff --git a/cards/Q-C.png b/cards/Q-C.png
new file mode 100644
index 0000000..7be5f9a
Binary files /dev/null and b/cards/Q-C.png differ
diff --git a/cards/Q-D.png b/cards/Q-D.png
new file mode 100644
index 0000000..928f650
Binary files /dev/null and b/cards/Q-D.png differ
diff --git a/cards/Q-H.png b/cards/Q-H.png
new file mode 100644
index 0000000..21839e6
Binary files /dev/null and b/cards/Q-H.png differ
diff --git a/cards/Q-S.png b/cards/Q-S.png
new file mode 100644
index 0000000..7983d03
Binary files /dev/null and b/cards/Q-S.png differ
diff --git a/styles.css b/styles.css
index c01ce3d..3906f2a 100644
--- a/styles.css
+++ b/styles.css
@@ -225,7 +225,7 @@
.bg {
width: 100%;
opacity; 50%;
- height: 200vh;
+ height: 100vh;
display: flex;
align-items: center;
justify-content: center;
@@ -269,11 +269,12 @@
flex-direction: column;
justify-content: center;
align-items: center;
- margin-top: 15%;
+
}
.doors {
/*display: flex;*/
+
}
.bank{
@@ -344,7 +345,7 @@ button {
body{
- color: rgb(137,46,255);
+ color: rgb(90,46,255);
font-family: "casino";
text-shadow: 0 0 7px rgb(147,112,219),
0 0 25px rgb(147,112,219),
@@ -356,7 +357,7 @@ body{
}
h1{
- color: rgb(137,46,255);
+ color: rgb(190,46,255);
text-shadow: 0 0 7px rgb(147,112,219),
0 0 10px rgb(147,112,219),
0 0 25px rgb(147,112,219),
@@ -367,8 +368,8 @@ h1{
.slot {
position: absolute;
z-index: 1;
- margin-top: 35%;
- margin-left: 38%;
+ margin-top: 18%;
+ margin-left: 39%;
}
@@ -376,9 +377,9 @@ h1{
h2{
position: absolute;
z-index: 1;
- font-size: 300%;
- margin-top: 20%;
- margin-left: 44%;
+ font-size: 200%;
+ margin-top: 15%;
+ margin-left: 46%;
color: rgb(90,46,255);
text-shadow: 0 0 7px rgb(0,0,219),
@@ -387,14 +388,71 @@ h2{
0 0 35px rgb(147,112,219),
0 0 45px rgb(147,112,219)
}
+
+
+#dealer-cards img {
+ height: 175px;
+ width: 125px;
+ margin: 1px;
+}
+
+#your-cards img {
+ height: 175px;
+ width: 125px;
+ margin: 1px;
+}
+
+#hit {
+ width: 100px;
+ height: 50px;
+ font-size: 20px;
}
+#stay {
+ width: 100px;
+ height: 50px;
+ font-size: 20px;
+}
+.buttonhs {
+ position: fixed;
+ margin-left: 5%;
+ margin-top: 2%;
+}
+.bjform {
+ position: absolute;
+ z-index: 1;
+ margin-top: 21%;
+ margin-left: 38%;
+}
+.h2bj {
+ position: absolute;
+ z-index: 1;
+ font-size: 200%;
+ margin-top: 15%;
+ margin-left: 43%;
+
+ color: rgb(90,46,255);
+ text-shadow: 0 0 7px rgb(0,0,219),
+ 0 0 10px rgb(147,112,219),
+ 0 0 25px rgb(147,112,219),
+ 0 0 35px rgb(147,112,219),
+ 0 0 45px rgb(147,112,219)
+
+}
+
+.reload {
+ position: absolute;
+ z-index: 1;
+ margin-top: 49%;
+ margin-left: 47%;
+
+}