Skip to content

Commit 593afe1

Browse files
committed
Create dice logic for the game
1 parent 0f4c95c commit 593afe1

File tree

1 file changed

+3
-1
lines changed
  • JS_Basic_Challenges/4-DOM-pig-game/starter

1 file changed

+3
-1
lines changed

JS_Basic_Challenges/4-DOM-pig-game/starter/app.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ GAME RULES:
1111
1212
*/
1313

14-
var totalScore, currentScore, activePlayer;
14+
var totalScore, currentScore, activePlayer, dice;
1515

1616
var totalScore = [0,0]; // the total score each player has, added together, after multiple rounds of rolling the dice
1717
var currentScore = 0; // the score each player has per round/ session, when it's they're actively rolling the dice
1818
var activePlayer = 0; // the player that is currently rolling the dice
19+
20+
dice = Math.floor(Math.random() * 6) + 1; // create a dice that generates a random number from 1 to 6 (included)

0 commit comments

Comments
 (0)