Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
print("Game one:")
game1 = HighTwoGame("Matt", "Ashley")
game1.playOneGame()

print("")
print("Game two:")
game2 = HighTwoGame("Dexter", "Eugene")
game2.playOneGame()
In this lab, we will create a two-player game called HighTwo. In this game, each player will roll one 6-sided die and one 10-sided die. The player with the higher sum wins!

To make this game, you will need to implement the following classes:

**Classes Overview:**

- **Die Class:**
  - Number of sides
  - Face up value
  - Methods: 
    - `roll`
    - `getValue`
    - `__str__`
    - `__add__`
    - `__gt__`

- **Player Class:**
  - Name
  - Two Dice
  - Methods:
    - `rollDice`
    - `getDieValue`
    - `__str__`

- **HighTwoGame Class:**
  - Two Players
  - Methods:
    - `playOneGame`
    - `playManyGames`
    - `__str__`

**Instructions:**

Start by downloading the `DiceGameProgram.py` from D2L. Then create a file called `DiceGameClasses.py` where you will implement the three classes above. Since the HighTwoGame class will implement a Player, and the Player class will implement a Die, it may be easiest to start by creating the Die class.

**Dice Class:**

1. **Requirements:**
   - You *must* implement the instance variables and methods listed above.
   - You *may* implement any other instance variables and methods that help you build the rest of the game.

2. **Constructor:**
   - The constructor should take the number of dice as an argument.

3. **Hints:**
   - Before a die is rolled for the first time, you can assume it has a face up value of 1.
   - A die has side numbers between 1 and the number of sides. When you roll a die, one of those numbers *randomly* lands face up.
   - `__add__` adds the face up value of two dice.
   - `__gt__` is a comparison operator.

**Player Class:**

1. **Requirements:**
   - You *must* implement the instance variables and methods listed above.
   - You *may* implement any other instance variables and methods that help you build the rest of the game.
expand button
Transcribed Image Text:In this lab, we will create a two-player game called HighTwo. In this game, each player will roll one 6-sided die and one 10-sided die. The player with the higher sum wins! To make this game, you will need to implement the following classes: **Classes Overview:** - **Die Class:** - Number of sides - Face up value - Methods: - `roll` - `getValue` - `__str__` - `__add__` - `__gt__` - **Player Class:** - Name - Two Dice - Methods: - `rollDice` - `getDieValue` - `__str__` - **HighTwoGame Class:** - Two Players - Methods: - `playOneGame` - `playManyGames` - `__str__` **Instructions:** Start by downloading the `DiceGameProgram.py` from D2L. Then create a file called `DiceGameClasses.py` where you will implement the three classes above. Since the HighTwoGame class will implement a Player, and the Player class will implement a Die, it may be easiest to start by creating the Die class. **Dice Class:** 1. **Requirements:** - You *must* implement the instance variables and methods listed above. - You *may* implement any other instance variables and methods that help you build the rest of the game. 2. **Constructor:** - The constructor should take the number of dice as an argument. 3. **Hints:** - Before a die is rolled for the first time, you can assume it has a face up value of 1. - A die has side numbers between 1 and the number of sides. When you roll a die, one of those numbers *randomly* lands face up. - `__add__` adds the face up value of two dice. - `__gt__` is a comparison operator. **Player Class:** 1. **Requirements:** - You *must* implement the instance variables and methods listed above. - You *may* implement any other instance variables and methods that help you build the rest of the game.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY