HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-03-09
1 <p>Now that we’ve made sure that dice roll is working, we need to enter players who will roll these dice and get game points for rolling them.</p>
1 <p>Now that we’ve made sure that dice roll is working, we need to enter players who will roll these dice and get game points for rolling them.</p>
2 <p>The players will be Muffin and his friend Rudolph. Add variables to store the points and name of each player in order to find and log the winner’s results in the console in the future. For each player, two variables will be created: name and points.</p>
2 <p>The players will be Muffin and his friend Rudolph. Add variables to store the points and name of each player in order to find and log the winner’s results in the console in the future. For each player, two variables will be created: name and points.</p>
3 <p>Since we have a function inside of which game points will be accrued and logged in the console, variables with names and points of players should be transferred to this function. Yes, the runGame function will now have five parameters, but what can you do? Such is the game.</p>
3 <p>Since we have a function inside of which game points will be accrued and logged in the console, variables with names and points of players should be transferred to this function. Yes, the runGame function will now have five parameters, but what can you do? Such is the game.</p>
4 <p>By the way, note that the names of variables and function parameters do not match. A variable that stores the number of dice is called diceNumber, and the name of the corresponding parameter quantity. The runGame function is an abstract one. Let us not forget that the game can change. For example, cats will want to play cards or the game will be played by people. That is why we will call the parameters that store the data of the players abstractly: firstPlayerName, firstPlayerPoints, secondPlayerName, secondPlayerPoints.</p>
4 <p>By the way, note that the names of variables and function parameters do not match. A variable that stores the number of dice is called diceNumber, and the name of the corresponding parameter quantity. The runGame function is an abstract one. Let us not forget that the game can change. For example, cats will want to play cards or the game will be played by people. That is why we will call the parameters that store the data of the players abstractly: firstPlayerName, firstPlayerPoints, secondPlayerName, secondPlayerPoints.</p>