# Assignment #3 Objectives

 Date 09.07.2017 Size 12.5 Kb.

Computing Science 120.s15 Page of

Assignment #3

Objectives:

• Learn how to write a simple animated game program

• Learn how to use if-else statements

• Learn how to use loops

• Learn how to create functions

• Learn hot to use list

• Learn how to implement the concept of object oriented programming

Description of Problem:

Write a simple animated program by using object-oriented design and Python. This program should be menu-driven. The first screen is the main-menu screen. In the main-menu screen, players can choose the different options of the program, such as:

• Help

• Play the Dice Game

• Check Player’s Performance

• Quit this Program

Every time when the Start option is chosen, the dice would flash for about 3 to 20 seconds and then stop. At this point, the win/lose status could be determined.

Assuming that there are three dice in this game, possible bets are: over_9, under_9, odd (sum of the three dice), or even (sum of the three dice).

Rules for this game:

• Permissible bets are: under_9, over_9, odd (sum of the three dice), or even (sum of the three dice).

• Reward for winning is one to one.
( i.e. Win 1 point for each correct bet, or lose 1 point for each wrong bet.).

• Whenever the player choose the start option, the three dice would flash for a few seconds and then stop,

Requirements:

• Your program must possess the following operations and properties:

• diceRoll(...) ----- to roll a die to generate a random number between 1 to 6.

• diceValue (...) ----- to return the current top-value of a die.

• diceSetDefaultValue(...) ----- to set an initial top-value before tossing the die.

• a variable called topValue to indicate the top-value of a die.

• Feel free to add any additional operations or properties if needed.

Whenever the “Check Player’s Performance” option is chosen, the player’s performance information should be displayed.

Possible player’s performance information could be:

• Initial Balance

• Current Balance

• Total Number of Plays

• Percentage of Wins (no. of wins / total no. of plays)

Hints:

• randint(a, b) ------ return a random integer N such that a <= N <= b.

Items to be handed in:

• An algorithm for this program.

• A printed copy of your Python source code and a printout of at least one sample run.

• All pages must be stapled together.

• No loose pages are accepted.

• The disk (USB memory stick, CD, diskette, etc) that you hand-in should contain all of your program files:

• Correctness, completeness, and no missing features / 3

• General, flexible, and efficient / 2

• Documentation, style of code, and sample run / 2

• User interface, ingenuity, and overall evaluation / 3

## Total: / 10

Note:

• Deduct half a point for each missing feature.

• Deduct half a point for any incorrect file name or folder name.

• Deduct half a point for any loose pages.

• Penalty for late submission of assignments is 5% for the first day, and an additional 10% for each day thereafter.

### Cheating and Plagiarism

Columbia College expects all students to uphold the principle of academic honesty. Cheating and plagiarism (presenting another person’s words or ideas as one’s own) are not acceptable behavior at any academic institution. Depending on the severity of the offense such acts can result in a grade of zero on the test or assignment, a failing grade (F) in the course or expulsion from the College. In all cases, the circumstances and the penalty are recorded in the student’s file.