The rules are as follows. The shooter rolls two dice. If the first roll is 2,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The rules are as follows. The shooter rolls two dice. If the first roll is 2, 3, or 12 the shooter loses. If the first roll is 7 or 11, the shooter wins. If the first roll is anything else, that value becomes the shooter's "point". The shooter continues to roll the dice until either the "point" comes up again, in which case the shooter wins, or until a 7 comes up, in which case the shooter loses. The program, will be created using 4 files: • A module called die.py which defines the Die class representing a single die. The die should have a succent value attribute that represents its current face-up value (i.e. the last value it was rolled). The die should also have a method called ro11() that sets its current value to a random integer between 1 and 6. • A module called pair_of_dice.py which defines the class Paicoffice which has two Die class attributes. It should have a call.diss) method and a succent value() method that returns the sum of its Die objects' current values. • A module called game_controller.py, which defines the SansController class to manage the rolling, scoring, and user interaction. This will be the file that contains the most code. • A main application called dice_game.py, with a main() method that prints out the rules and then calls a method on the game controller to initiate the game. Running the game A few examples of the game in action are shown below: $ python dice_game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your 'point', and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... Your point is 4 Press enter to roll the dice... You rolled 7. You lose. $ python dice game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your 'point', and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... You rolled 11. You win! $ python dice_game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your 'point', and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... Your point is 8 Press enter to roll the dice.... You rolled 4. Press enter to roll the dice... You rolled 7. You lose. $ python dice_game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your "point", and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... Your point is 10 Press enter to roll the dice.... You rolled 8. Press enter to roll the dice.... You rolled 4. Press enter to roll the dice... You rolled 10. You win! The rules are as follows. The shooter rolls two dice. If the first roll is 2, 3, or 12 the shooter loses. If the first roll is 7 or 11, the shooter wins. If the first roll is anything else, that value becomes the shooter's "point". The shooter continues to roll the dice until either the "point" comes up again, in which case the shooter wins, or until a 7 comes up, in which case the shooter loses. The program, will be created using 4 files: • A module called die.py which defines the Die class representing a single die. The die should have a succent value attribute that represents its current face-up value (i.e. the last value it was rolled). The die should also have a method called ro11() that sets its current value to a random integer between 1 and 6. • A module called pair_of_dice.py which defines the class Paicoffice which has two Die class attributes. It should have a call.diss) method and a succent value() method that returns the sum of its Die objects' current values. • A module called game_controller.py, which defines the SansController class to manage the rolling, scoring, and user interaction. This will be the file that contains the most code. • A main application called dice_game.py, with a main() method that prints out the rules and then calls a method on the game controller to initiate the game. Running the game A few examples of the game in action are shown below: $ python dice_game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your 'point', and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... Your point is 4 Press enter to roll the dice... You rolled 7. You lose. $ python dice game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your 'point', and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... You rolled 11. You win! $ python dice_game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your 'point', and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... Your point is 8 Press enter to roll the dice.... You rolled 4. Press enter to roll the dice... You rolled 7. You lose. $ python dice_game.py Welcome to street craps! Rules: If you roll 7 or 11 on your first roll, you win. If you roll 2, 3, or 12 on your first role, you lose. If you roll anything else, that's your "point", and you keep rolling until you either roll your point again (win) or roll a 7 (lose) Press enter to roll the dice... Your point is 10 Press enter to roll the dice.... You rolled 8. Press enter to roll the dice.... You rolled 4. Press enter to roll the dice... You rolled 10. You win!
Expert Answer:
Answer rating: 100% (QA)
ANSWER First lets define the Die class in diepy import random class Die def initself selfvalue None def rollself selfvalue randomrandint1 6 This class represents a single die It has a value attribute ... View the full answer
Related Book For
Probability And Statistics
ISBN: 9780321500465
4th Edition
Authors: Morris H. DeGroot, Mark J. Schervish
Posted Date:
Students also viewed these programming questions
-
In which case would the shortage resulting from a price ceiling be greater: when supply is inelastic or elastic? Explain your answer. a. Inelastic. The reason is that the response in quantity...
-
Find the probability that a random integer between 1 and 5000 is divisible by 4, 7 or 10.
-
In which case is the momentum change of a baseball largest, (a) A pitch caught by a catcher, (b) A baseball thrown by a pitcher, or (c) A baseball hit by a batter? Explain your answer.
-
Associated Media Graphics (AMG) is a rapidly expanding company involved in the mass reproduction of instructional materials. Ralph Boston, owner and manager of AMG, has made a concentrated effort...
-
Ethics and quality. Wainwright Corporation manufactures auto parts for two leading Japanese automakers. Nancy Evans is the management accountant for one of Wainwrights largest manufacturing plants....
-
The cohesion of Alexander the Greats vast empire was _______; at his death, Alexanders lands were divided among his generals, Ptolemy, Seleucus, and Antigonus the One-Eyed. a. Abiding b. Precarious...
-
On December 31, 2017, Shade Company issued \(\$ 250,000\) of 20 -year, eight percent bonds payable for \(\$ 276,694\), yielding an effective interest rate of seven percent. Interest is payable...
-
Consider the following partially completed master schedule record: a. Complete the projected on-hand inventory calculations and the available-to-promise calculations. b. Suppose that a customer calls...
-
Two weeks after the initial questionnaire was completed, the first 30 patients were mailed a second identical questionnaire." The authors use this approach to check for: Criterion validity...
-
Answer the following questions related to the Docks Creek Land Company case presented in the chapter: 1. How does Robertsons role differ from Wisemans? 2. Are the professional standards applied...
-
Foreign market entry mode International joint venture vs. Exporting ABYZ Company is a successful Australian business. Currently, it manufactures within Australia and exports its products to overseas...
-
You are given an array. The array can contain positive and negative integers. You need to find two elements such that their sum is closest to zero. For example, you are given an array {-4, 7, 6, 2,...
-
To evaluate the derivative of tanh- (x), we invert the equation y = tanh- (2) to express a tanh(y). dx We then compute the derivative dy dy as a function of y. da However, we normally want to use the...
-
A company has $1,406 in inventory, $4,863 in net fixed assets, $688 in accounts receivable, $314 in cash, $658 in accounts payable, and $5,458 in equity. What is the companys long term debt?
-
1. Typical capital budgeting approaches does not account for the potential value of future expansion opportunities which may become available later in the life of the project. a)Provide an example of...
-
Find Vacant 2022, and monthly supply MS using the following: Vacant2021 = 4m SF. Construction2022 = 6m SF. Net Absorption2022 = 1m SF. Gross Absorption2022 = 2.5m SF.
-
20.A fire-tube boiler operates at 200 psia (1.378 MPa) with 200F (93.3C) feedwater, both at saturated condition. The diameter of the boiler is 213.4 cm, length of 5.5 m, and having 84 tubes, 10.2 cm...
-
A local politician is concerned that a program for the homeless in her city is discriminating against blacks and other minorities. The following data were taken from a random sample of black and...
-
Rutherford and Geiger (1910) counted the numbers of alpha particles emitted by a certain mass of polonium during 2608 disjoint time periods, each of which lasted 7.5 seconds. The results are given in...
-
In Example 3.9.10, use the Jacobian method (3.9.13) to verify that Y and Z are independent and that Eq. (3.9.18) is the marginal p.d.f. of Z.
-
Consider again the conditions of Exercises 19 and 20, and let the estimators be as given , j, and B; in Exercise 20. Show thatov(i, ) = Cov(i, B) =0.
-
Steven Myer and William Riggs are partners in an existing business. Each partner has equity of \($30,000.00.\) On October 1 of the current year, the two partners agree to admit Sandra DeVito as a...
-
Stanley Neal and Helen Jobe each have equity of $40,000.00 in an existing partnership. The partners share equally in all changes in equity. On August 1 of the current year, the existing partners...
-
Susan Wang and Lelah Burch are partners in an existing business. Each partner has $60,000.00 equity in the partnership. Partners share equally in all changes in equity. On April 1 of the current...
Study smarter with the SolutionInn App