For this lab, you will be creating an object-oriented (OO) program to play a simple dice game. Start with the following:
In the dice module, write the Dice class. A Dice object should have two properties/attributes: the number of sides the dice has, and the current value showing on the dice. These properties should be attributes in your class (also known as instance variables).
Add the following methods:
In the main module, write the main() function to play a simple game according to the following rules:
Your main function should create variables for the two dice: each should be an object of type Dice.
Your program should use the input function to ask the user to hit return before each turn. After each turn, the program should check if we've won. If we've won, print a message saying so and end the program.
Now, go back and modify the Dice class so that the default number of sides is 6, so that if we ask to create a dice without specifying the number of sides, we will get a D6. Modify main() so it uses this default as appropriate.
Before turning in any program in this class, remember this mantra:
Just because it works doesn't mean it's good.
Part of your grade will also come from things like how understandable and readable your code is. You will also be graded on the neatness, presentation, and style of your program code.
For all labs, turn in only an electronic version. Please compress your program and email the zip file or tarball to me at email@example.com.
Ask for help if you're having problems!