Lab 9

Create a game where 6 dice are 'rolled' by you and 6 dice are 'rolled' by the computer (simulated by the click of a button). Add up both rolls. The goal is to roll a cumulative score greater than 50 and as close to 100 as possible, without passing 100. Have a STAND button to signify when you are ready to stop rolling and compute the winner. The highest score under 100 wins. Display the number of times you win and the number of times the computer wins. (To better understand this game, think of black jack where you want your score to be greater than the computer's, without busting).

The homework needs to implement 6 dice being rolled at once. To implement this, consider using an array for humanDice and computerDice which could hold multiple values, and a for loop. For each roll, 6 total, have humanDice[i] = roll(); Still within the for loop, update the running total of humanTotal (humanTotal += humanDice[i]) The same will be done for the computer, except that the style.visibility of the computerDice and computerTotal will be set to hidden until we calculate the winner. Once the user hits the 'stand' button, we must calcWinner Use the global variables finalHumanScore/ finalComputerScore to compare with a series of logical expressions and if statements will compare the two values. for the homework, firstly we should look to see if you and/or the computer busted (greater than 100), if both values are under a 100, then we compare whether hScore or cScore is greater.