diff --git a/Contributors.html b/Contributors.html
index 91224e8672..01243a07a6 100644
--- a/Contributors.html
+++ b/Contributors.html
@@ -1899,6 +1899,12 @@
"username": "https://github.com/srinjoy-26"
},
+ {
+ "id" : 349,
+ "full name": "Rajpreet Kaur",
+ "username": "https://github.com/Rajpreetkaur02"
+ }
+
{
"id": 349,
@@ -1962,6 +1968,7 @@
"fullname": "Avadhoot Kulkarni",
"username": "https://github.com/AvadhootK"
}
+
];
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/10.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/10.png
new file mode 100644
index 0000000000..01be5daa37
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/10.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/2.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/2.png
new file mode 100644
index 0000000000..2f1d24063f
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/2.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/3.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/3.png
new file mode 100644
index 0000000000..0deaff3d8b
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/3.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/4.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/4.png
new file mode 100644
index 0000000000..8f2e6b0fef
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/4.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/5.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/5.png
new file mode 100644
index 0000000000..9306d72092
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/5.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/6.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/6.png
new file mode 100644
index 0000000000..98df25f010
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/6.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/7.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/7.png
new file mode 100644
index 0000000000..5efbb828f3
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/7.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/8.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/8.png
new file mode 100644
index 0000000000..277705b131
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/8.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/9.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/9.png
new file mode 100644
index 0000000000..79eb5857d7
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/9.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/A.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/A.png
new file mode 100644
index 0000000000..bb25fee819
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/A.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/J.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/J.png
new file mode 100644
index 0000000000..7960a94e7a
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/J.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/K.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/K.png
new file mode 100644
index 0000000000..c9d1c990ea
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/K.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/Q.png b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/Q.png
new file mode 100644
index 0000000000..6499247e29
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/images/Q.png differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/index.html b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/index.html
new file mode 100644
index 0000000000..4fa6f9854e
--- /dev/null
+++ b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/index.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+ Document
+
+
+
+
+
Challenge 5: Blackjack
+
LET'S PLAY!
+
+
+
You: 0
+
+
+
Dealer: 0
+
+
+
+
+
+
+
+
+
+
+
+
+ win |
+ losses |
+ draws |
+
+
+ 0 |
+ 0 |
+ 0 |
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/script.js b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/script.js
new file mode 100644
index 0000000000..04e5bc309f
--- /dev/null
+++ b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/script.js
@@ -0,0 +1,163 @@
+let blackjackgame = {
+ 'you': {'resultspan': '#your-blackjack-result','div':'#your-box','score':0},
+ 'dealer': {'resultspan': '#dealer-blackjack-result','div':'#dealer-box','score':0},
+ 'cards': ['2','3','4','5','6','7','8','9','10','K','J','Q','A'],
+ 'scorecard':{'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, '10':10, 'K':10, 'J':10, 'Q':10, 'A':[1,11] },
+ 'wins':0,
+ 'losses':0,
+ 'draws':0,
+ 'isStand':false,
+ 'turnsOver':false
+};
+
+const YOU = blackjackgame['you']
+const DEALER = blackjackgame['dealer']
+
+const hitsound = new Audio('sounds/swish.m4a');
+const winsound = new Audio('sounds/cash.mp3');
+const lostsound = new Audio('sounds/aww.mp3');
+
+
+document.querySelector('#blackjack-hit').addEventListener('click',blackjackhit);
+document.querySelector('#blackjack-stand').addEventListener('click',dealerLogic);
+document.querySelector('#blackjack-deal').addEventListener('click',blackjackDeal);
+
+function blackjackhit(){
+ if(blackjackgame['isStand'] === false){
+ let card = randomCard();
+ showCard(card,YOU);
+ updateScore(card,YOU);
+ showScore(YOU);
+ console.log(YOU['score']);
+ }
+}
+
+function showCard(card, activeplayer){
+ if(activeplayer['score']<=21){
+ let cardimage = document.createElement('img');
+ cardimage.src = `images/${card}.png`;
+ document.querySelector(activeplayer['div']).appendChild(cardimage);
+ hitsound.play();
+ }
+}
+
+function randomCard(){
+ let randomIndex = Math.floor(Math.random()*13);
+ return blackjackgame['cards'][randomIndex];
+}
+
+function blackjackDeal(){
+ if(blackjackgame['turnsOver'] === true){
+ blackjackgame['isStand'] = false;
+ let yourImages = document.querySelector('#your-box').querySelectorAll('img');
+ let dealerImages = document.querySelector('#dealer-box').querySelectorAll('img');
+ for(i=0;i21){
+ document.querySelector(activeplayer['resultspan']).textContent = 'BUST!';
+ document.querySelector(activeplayer['resultspan']).style.color = 'red';
+ }else{
+ document.querySelector(activeplayer['resultspan']).textContent = activeplayer['score'];
+ }
+}
+
+function sleep(ms){
+ return new Promise(resolve => setTimeout(resolve,ms));
+}
+
+async function dealerLogic(){
+ blackjackgame['isStand']=true;
+
+ while(DEALER['score'] < 16 && blackjackgame['isStand'] === true){
+ let card = randomCard();
+ showCard(card,DEALER);
+ updateScore(card,DEALER);
+ showScore(DEALER);
+ await sleep(1000);
+ }
+ blackjackgame['turnsOver']=true;
+ let winner = computewinner();
+ showWinner(winner);
+}
+
+function computewinner(){
+ let winner;
+ if(YOU['score']<=21){
+ if(YOU['score'] > DEALER['score'] || (DEALER['score'] > 21)){
+ blackjackgame['wins']++;
+ winner = YOU;
+ }
+ else if(YOU['score'] < DEALER['score']){
+ blackjackgame['losses']++;
+ winner = DEALER;
+ }
+ else if(YOU['score'] === DEALER['score']){
+ blackjackgame['draws']++;
+ }
+ }
+ else if(YOU['score'] > 21 && DEALER['score'] <= 21){
+ blackjackgame['losses']++;
+ winner = DEALER;
+ }
+ else if(YOU['score'] > 21 && DEALER['score'] > 21){
+ blackjackgame['draws']++;
+ }
+ return winner;
+}
+
+function showWinner(winner){
+ let message,msgcolor;
+ if(blackjackgame['turnsOver'] === true){
+ if(winner === YOU){
+ document.querySelector('#wins').textContent = blackjackgame['wins'];
+ message = 'YOU WON!!';
+ msgcolor = 'green';
+ winsound.play();
+ }
+ else if(winner === DEALER){
+ document.querySelector('#losses').textContent = blackjackgame['losses'];
+ message = 'YOU LOST!!';
+ msgcolor = 'red';
+ lostsound.play();
+ }
+ else{
+ document.querySelector('#draws').textContent = blackjackgame['draws'];
+ message = 'YOU DREW!!';
+ msgcolor = 'yellow';
+ }
+ document.querySelector('#blackjack-result').textContent = message;
+ document.querySelector('#blackjack-result').style.color = msgcolor;
+ }
+}
+
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/.DS_Store b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/.DS_Store
new file mode 100644
index 0000000000..5008ddfcf5
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/.DS_Store differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/aww.mp3 b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/aww.mp3
new file mode 100644
index 0000000000..1a57bae92e
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/aww.mp3 differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/cash.mp3 b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/cash.mp3
new file mode 100644
index 0000000000..0aa9e10e6f
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/cash.mp3 differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/swish.m4a b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/swish.m4a
new file mode 100644
index 0000000000..1e27ba6840
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/sounds/swish.m4a differ
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/style.css b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/style.css
new file mode 100644
index 0000000000..b49d272c0d
--- /dev/null
+++ b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/style.css
@@ -0,0 +1,66 @@
+body{
+ background-color: black;
+}
+.container{
+ border: 1px solid white;
+ color: white;
+ margin: 0 auto;
+ text-align: center;
+ width: 75%;
+ background-color: black;
+}
+.flex-blackjack-row-1,.flex-blackjack-row-2,.flex-blackjack-row-3{
+ display: flex;
+ border: 1px solid white;
+ padding: 3px;
+ flex-wrap: wrap;
+ flex-direction: row;
+ justify-content: space-around;
+}
+.flex-blackjack-row-1{
+ color: white;
+ background: url('table.jpg') center;
+}
+.flex-blackjack-row-1 div{
+ border: 1px solid white;
+ padding: 10px;
+ flex: 1;
+ text-align: center;
+ height: 350px;
+}
+.flex-blackjack-row-1 img{
+ width: 20%;
+ padding: 10px;
+}
+table,th,td{
+ padding: 1px;
+ border: 1px solid white;
+ color: white;
+}
+#blackjack-hit{
+ color: white;
+ background-color: cornflowerblue;
+ border: 1px solid white;
+ padding: 10px;
+ margin: 10px;
+ height: 40;
+ width: 80;
+}
+#blackjack-stand{
+ color: black;
+ background-color: yellow;
+ border: 1px solid white;
+ padding: 10px;
+ margin: 10px;
+ height: 40;
+ width: 80;
+}
+#blackjack-deal{
+ color: white;
+ background-color: red;
+ border: 1px solid white;
+ padding: 10px;
+ margin: 10px;
+ height: 40;
+ width: 80;
+}
\ No newline at end of file
diff --git a/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/table.jpg b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/table.jpg
new file mode 100644
index 0000000000..d1a0487baf
Binary files /dev/null and b/Program's_Contributed_By_Contributors/JavaScript_Programs/BlackJack_Game/table.jpg differ