Skip to content

Commit

Permalink
Added the winning scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdelrahman-Adel610 committed Aug 19, 2024
1 parent b772baf commit 7427942
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CSS/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ main {

/********** focus for the player's turn **********/
.focus {
background-color: #D7AFBF;
background-color: #D7AFBF !important;
}

.focus h1 {
Expand Down
13 changes: 13 additions & 0 deletions JS/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ function takeTurns() {
}
updateCurrentScores();
updateFinalScores();
if (!state && bank1 >= 100) {
player1.style.backgroundColor = "#22c55e";
rollDice.disabled = true;
hold.disabled = true;
} else if (state && bank2 >= 100) {
player2.style.backgroundColor = "#22c55e";
rollDice.disabled = true;
hold.disabled = true;
}
state = !state;
player1.classList.toggle("focus");
player2.classList.toggle("focus");
Expand All @@ -57,6 +66,10 @@ function resetGame() {
currentScore1 = 0;
currentScore2 = 0;
state = 0;
rollDice.disabled = false;
hold.disabled = false;
player1.style.backgroundColor = "#B57A9D";
player2.style.backgroundColor = "#B57A9D";
if (!player1.classList.contains("focus")) {
player1.classList.toggle("focus");
player2.classList.toggle("focus");
Expand Down

0 comments on commit 7427942

Please sign in to comment.