HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-03-09
1 <ul><li>script.js</li>
1 <ul><li>script.js</li>
2 </ul><p>JavaScript</p>
2 </ul><p>JavaScript</p>
3 <p>var gameRules = { diceNumber: 2, maxAttempts: 3 }; var firstCat = { name: 'Muffin', points: 0 }; var secondCat = { name: 'Rudolph', points: 0 }; var cats = [firstCat, secondCat]; var runGame = function (rules, players) { for (var i = 0; i &lt; players.length; i++) { var throwResult = muffin.throwDice(rules.diceNumber, rules.diceNumber * 6); players[i].points += throwResult; console.log(players[i].name + ' rolled ' + players[i].points); } return players; }; cats = runGame(gameRules, cats); console.log(cats);</p>
3 <p>var gameRules = { diceNumber: 2, maxAttempts: 3 }; var firstCat = { name: 'Muffin', points: 0 }; var secondCat = { name: 'Rudolph', points: 0 }; var cats = [firstCat, secondCat]; var runGame = function (rules, players) { for (var i = 0; i &lt; players.length; i++) { var throwResult = muffin.throwDice(rules.diceNumber, rules.diceNumber * 6); players[i].points += throwResult; console.log(players[i].name + ' rolled ' + players[i].points); } return players; }; cats = runGame(gameRules, cats); console.log(cats);</p>
4 <p>Thanks! We’ll fix everything at once!</p>
4 <p>Thanks! We’ll fix everything at once!</p>
5 <h2>Result</h2>
5 <h2>Result</h2>
6 <ol><li>In the body of the runGame function, write a for loop, which increases the counter currentAttempt from 1 to rules.maxAttempts including the one after each iteration.</li>
6 <ol><li>In the body of the runGame function, write a for loop, which increases the counter currentAttempt from 1 to rules.maxAttempts including the one after each iteration.</li>
7 <li>Transfer the rest of the function body code, except return , to the new loop.</li>
7 <li>Transfer the rest of the function body code, except return , to the new loop.</li>
8 </ol>
8 </ol>