(60) A score of sixty may indicate a failure to read instructions carefully. The user input...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(60) A score of sixty may indicate a failure to read instructions carefully. The user input for re-rolls is ordered (and ordered left to right). A re-roll input of 123 says roll the 1 then the 2 then the 3. It matters. Otherwise if the second input is 1 or 3 you will be rolling the die the tester is trying to keep. (5) A score of 5 likely has multiple problems but one of them is that you are not ending the turn on input of 0. Instead you have read the input for the next turn as the second re-roll input. You program will run out of input and probably reuse an old input value. (15) A score of 15 may indicate a problem with scoring rolls like 16266. I've seen this a few times now. (70) A score of 70 means you aren't ending the turn on 0 for the first re-roll. UPDATE: (0) COMMON PROBLEM: If you are getting a score of 5 or 15 you are probably not ending the turn after a zero on the first reroll. If the user enters a zero there will be no input for a second reroll on that turn. If you read that will be the input for the next turn. And you will run out of input. Scanf will start to fail so the input variable will not change. This is why you may still get the first test correct. Your program will believe seven additional zeros were supplied as input. On one of the tests you may get the scores right until a zero is offered on the first reroll. The input will be out of synch after that. This was listed as IMPORTANT in the instructions under interface. (1) XahtC.-- rolling the dice . Use the expression (rand() %6+1) to simulate a roll of the dice. o cand() is a function that generates a random positive integer. %6 modulates the random integer into a range 0.5 +1 makes the range 16 just like a dice is expected. In the tester I make use of the fact that I can control the random numbers generated -- do not call and more than required or the numbers you use will not be the numbers expected to be generated by the tester. Do not call seed again. This will result in a different than expected set of numbers. (2) YahtC.-- rerolling the dice (2) YahtC -- rerolling the dice When the user chooses to reroll the reroll needs to happen in order left to right If the user rerolls: 135, first roll die 1 then die 3 then die 5. (#1 PROBLEM IN STUDENT SUBMISSIONS) Otherwise if we reroll only 3 or 5 on the last try we won't be rolling the same die. . . (3) An error in Test case 7 Test case 7 was missing some input. This has been corrected. You do not have to resubmit if you received the point already anyway. (4) Library differences You are not guaranteed the Zybooks rand() is the same as your rand() just as we may have difference with strcmp() (some libraries always return -1, 0, 1, some don't). Welcome to YahtC YahtC is a dice game (very) loosely modeled on Yahtzee(tm) BUT YahtC is not Yahtzee(tm). Rules of YahtC: 5 dice are rolled The user selects which dice to roll again. The user may choose to roll none or all 5 or any combination. And then the user selects which dice to roll, yet again. After this second reroll the turn is scored. Scoring is as follows: 50 points 5 of a kind scores 50 points. . 45 points No pairs (all unique) scores 45 points. 40 points 4 of a kind scores 40 points. 30 points 3 of a kind scores 30 points. Total Dice Otherwise score the dice total. Interface: To indicate nothing to reroll the user will input 0 o This should end the players turn. You must use the template. The code in the template must remain. Specifically int main(int arge, char * argv) { seed (arge, argu); will be required for correct scoring. The seed function will set the random number generator to specific sequences that can be repeated. The template will also provide a function that prints the game rules instructions but it's presence or absence will not affect grading. Example Run: Below I present a full example run. Your prompts during game play may vary slightly (the input should remain the same). /a.out Ak Welcome to YahtC + ********* . ********** YahtC is a dice game (very) loosely modeled on Yahtzee BUT YahtC is not Yahtzee. Rules: 5 dice are rolled The user selects which dice to roll again. The user may choose to roll none or all 5 or any combination. And then the user selects which dice to roll, yet again. After this second reroll the turn is scored. Scoring is as follows: 50 points 5 of a kind scores 50 points. * 45 points No pairs (all unique) scores 45 points. 40 points 4 of a kind scores 40 points. 30 points 3 of a kind scores 30 points. Total Dice Otherwise score the dice total. To indicate nothing to reroll the user will input 0 This should end the players turn. Otherwise the user will indicate which dice to reroll by position 135 would indicate to reroll the first, third and last die. The numbers do not have to be given in order The game ends after 7 turns. ** First Roll = 24512 Select dice to reroll:1 second: 64512 Select dice to reroll:0 score for 64512 is 45 First Roll = 25665 Select dice to reroll:1 second: 55665 Select dice to reroll:34 final: 55515 score for 55515 is 40 First Roll = 55224 Select dice to reroll:5 second: 55221 Select dice to rerol1:5 final:55222 score for 55222 is 30 First Roll = 26566 Select dice to rero11:13 second: 36466 Select dice to reroll:13 final: 36566 score for 36566 is 30 First Roll 21511 Select dice to reroll:13 second: 11311 Select dice to rero11:3 final:11311 score for 11311 is 40 First Roll = 51411 Select dice to rero11:13 second: 61211 Select dice to reroll: 13 final:61511 score for 61511 is 30 First Roll 44154 Select dice to reroll:34 second: 44434 Select dice to reroll:4 final: 44464 score for 44464 is 40 ---------- SCORESHEET -------- Turn 1: 45 Turn 2: 40 Turn 3: 30 Turn 4: 30 Turn 5: 40 Turn 6: 30 Turn 7: 40 ======= Total: 255 (60) A score of sixty may indicate a failure to read instructions carefully. The user input for re-rolls is ordered (and ordered left to right). A re-roll input of 123 says roll the 1 then the 2 then the 3. It matters. Otherwise if the second input is 1 or 3 you will be rolling the die the tester is trying to keep. (5) A score of 5 likely has multiple problems but one of them is that you are not ending the turn on input of 0. Instead you have read the input for the next turn as the second re-roll input. You program will run out of input and probably reuse an old input value. (15) A score of 15 may indicate a problem with scoring rolls like 16266. I've seen this a few times now. (70) A score of 70 means you aren't ending the turn on 0 for the first re-roll. UPDATE: (0) COMMON PROBLEM: If you are getting a score of 5 or 15 you are probably not ending the turn after a zero on the first reroll. If the user enters a zero there will be no input for a second reroll on that turn. If you read that will be the input for the next turn. And you will run out of input. Scanf will start to fail so the input variable will not change. This is why you may still get the first test correct. Your program will believe seven additional zeros were supplied as input. On one of the tests you may get the scores right until a zero is offered on the first reroll. The input will be out of synch after that. This was listed as IMPORTANT in the instructions under interface. (1) XahtC.-- rolling the dice . Use the expression (rand() %6+1) to simulate a roll of the dice. o cand() is a function that generates a random positive integer. %6 modulates the random integer into a range 0.5 +1 makes the range 16 just like a dice is expected. In the tester I make use of the fact that I can control the random numbers generated -- do not call and more than required or the numbers you use will not be the numbers expected to be generated by the tester. Do not call seed again. This will result in a different than expected set of numbers. (2) YahtC.-- rerolling the dice (2) YahtC -- rerolling the dice When the user chooses to reroll the reroll needs to happen in order left to right If the user rerolls: 135, first roll die 1 then die 3 then die 5. (#1 PROBLEM IN STUDENT SUBMISSIONS) Otherwise if we reroll only 3 or 5 on the last try we won't be rolling the same die. . . (3) An error in Test case 7 Test case 7 was missing some input. This has been corrected. You do not have to resubmit if you received the point already anyway. (4) Library differences You are not guaranteed the Zybooks rand() is the same as your rand() just as we may have difference with strcmp() (some libraries always return -1, 0, 1, some don't). Welcome to YahtC YahtC is a dice game (very) loosely modeled on Yahtzee(tm) BUT YahtC is not Yahtzee(tm). Rules of YahtC: 5 dice are rolled The user selects which dice to roll again. The user may choose to roll none or all 5 or any combination. And then the user selects which dice to roll, yet again. After this second reroll the turn is scored. Scoring is as follows: 50 points 5 of a kind scores 50 points. . 45 points No pairs (all unique) scores 45 points. 40 points 4 of a kind scores 40 points. 30 points 3 of a kind scores 30 points. Total Dice Otherwise score the dice total. Interface: To indicate nothing to reroll the user will input 0 o This should end the players turn. You must use the template. The code in the template must remain. Specifically int main(int arge, char * argv) { seed (arge, argu); will be required for correct scoring. The seed function will set the random number generator to specific sequences that can be repeated. The template will also provide a function that prints the game rules instructions but it's presence or absence will not affect grading. Example Run: Below I present a full example run. Your prompts during game play may vary slightly (the input should remain the same). /a.out Ak Welcome to YahtC + ********* . ********** YahtC is a dice game (very) loosely modeled on Yahtzee BUT YahtC is not Yahtzee. Rules: 5 dice are rolled The user selects which dice to roll again. The user may choose to roll none or all 5 or any combination. And then the user selects which dice to roll, yet again. After this second reroll the turn is scored. Scoring is as follows: 50 points 5 of a kind scores 50 points. * 45 points No pairs (all unique) scores 45 points. 40 points 4 of a kind scores 40 points. 30 points 3 of a kind scores 30 points. Total Dice Otherwise score the dice total. To indicate nothing to reroll the user will input 0 This should end the players turn. Otherwise the user will indicate which dice to reroll by position 135 would indicate to reroll the first, third and last die. The numbers do not have to be given in order The game ends after 7 turns. ** First Roll = 24512 Select dice to reroll:1 second: 64512 Select dice to reroll:0 score for 64512 is 45 First Roll = 25665 Select dice to reroll:1 second: 55665 Select dice to reroll:34 final: 55515 score for 55515 is 40 First Roll = 55224 Select dice to reroll:5 second: 55221 Select dice to rerol1:5 final:55222 score for 55222 is 30 First Roll = 26566 Select dice to rero11:13 second: 36466 Select dice to reroll:13 final: 36566 score for 36566 is 30 First Roll 21511 Select dice to reroll:13 second: 11311 Select dice to rero11:3 final:11311 score for 11311 is 40 First Roll = 51411 Select dice to rero11:13 second: 61211 Select dice to reroll: 13 final:61511 score for 61511 is 30 First Roll 44154 Select dice to reroll:34 second: 44434 Select dice to reroll:4 final: 44464 score for 44464 is 40 ---------- SCORESHEET -------- Turn 1: 45 Turn 2: 40 Turn 3: 30 Turn 4: 30 Turn 5: 40 Turn 6: 30 Turn 7: 40 ======= Total: 255
Expert Answer:
Answer rating: 100% (QA)
c include iostream include cstdlib include ctime void printGameRule... View the full answer
Related Book For
Calculus And Its Applications
ISBN: 9780134437774
14th Edition
Authors: Larry Goldstein, David Lay, David Schneider, Nakhle Asmar
Posted Date:
Students also viewed these programming questions
-
An 8 g sample of sulfur is introduced into a calorimeter containing 400g water. When the S sample is burned completely to form SO2 (g), the water temp is observed to increase by 66 C. Determine the...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Water falls over a dam of height h with a mass flow rate of R, in units of kg/s. (a) Show that the power available from the water is P = Rgh where g is the free-fall acceleration. (b) Each...
-
Avnet is one of the world's largest value-added distributors of electronic components, enterprise computer and storage products, IT services and embedded subsystems. Avnet creates a vital link in the...
-
The case study that involved balancing a gas turbine that could not pass through its first critical frequency called for use of the existing proximity probe outputs input into a digital FFT using...
-
Due to recent beef recalls, Southwest Steakhouse is considering incorporating. Bob, the owner, wants to protect his personal assets in the event the restaurant is sued. Requirements 1. Which...
-
First, watch the crash course on 'Due Process' listed for this week and then read the short article on a Virginia fight club published by the Washington Post (link below and Word Doc at the bottom):...
-
Lannion and Co. is engaged in providing and marketing a standard advice service. Summarised results for the past two months reveal the following: There were no price changes of any description during...
-
1. In an ideal Otto cycle, 1000 kJ/kg of heat is inputed per cycle. The temperature and pressure at the beginning of the compression are 15C and 0.1MPa, respectively, with a compression ratio of 10...
-
Calculate the following: 1. Break-even point in units 2. Break-even point in revenue
-
1. Carter Components is computing the components of its pension expense for the current year ended December 31. Carter has calculated that its service cost is $60,000 and has computed interest cost...
-
Data related to the inventories of Shanahan are presented below: Bowling Balls $44 $35 $12 $31 210 Resistance Bands $59 $39 $13 $41 140 Selling price Cost Costs to sell Replacement cost Quantity Use...
-
A four-stroke 6 L engine is fueled lean with methane at an equivalence ratio ???? = 0.8. It operates at 2000 rpm with a volumetric efficiency of 0.80. The exhaust temperature is 800 K, and the heat...
-
Sonata Company has no investment opportunities. It expects to earn cash earnings per share of Rs 10 perpetually and distribute entire earnings as dividends to shareholders.( a ) What is the value of...
-
Compound interest (a) You are to choose between two investments: one pays 6% compounded quarterly, and the other pays 5% compounded daily. If you plan to invest $20,000 for 2 years, which investment...
-
Subtract the polynomials. (-x+x-5) - (x-x + 5)
-
The width of a rectangle is increasing at a rate of 3 inches per second and its length is increasing at the rate of 4 inches per second. At what rate is the area of the rectangle increasing when its...
-
The revenue function for a particular product is R(x) = x(4 - .0001x). Find the largest possible revenue.
-
If f(x) and g(x) are differentiable functions such that f(2) = f(2) = 3, g(2) = 3, and g(2) = 1/3, compute the following derivatives: d dx [xf(x)] x=2
-
Two Population Poissons. We can express the two population problem in a regression context using one explanatory variable. Specifically, suppose that \(x_{i}\) only takes on the values of zero and...
-
Derive the likelihood for the tobit type II model. Show that your likelihood reduces to equation (16.5) in the case of uncorrelated disturbance terms. n2. (16.5) -(-)-(-2)/02 L = [] {(p;)" (1 p;...
-
The product-as-a-service business model can generate large profits. Instead of producing and selling a product, the producer is responsible for the product for its entire life. The customer uses the...
Study smarter with the SolutionInn App