DOC PREVIEW
USF CS 110 - Programming Assignment 5

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Programming Assignment 5Computer Science 110-03Due date: Wednesday, December 71 BlackjackIn the game of blackjack, one or more players play against the dealer. At the start of the gameeach player is dealt two cards face up. The dealer is dealt one card face up and one card face down.Then, starting with the first player, each player can get more cards (“hits”) until she “stands” or“busts.” The dealer is the last person to play. When she starts to play, s he turns her face downcard — her “hole” card — face up.The object of the game is to get a total that’s as close to 21 as possible, without getting a totalover 21. Each card with a numerical rank (2, 3, . . . , 10) is worth its numerical value, face cards areworth 10, and an ace is worth 1 or 11. (Suits don’t matter.) A total over 21 is a “bust.” A totalof 21 in the first two cards is called a “natural” or “blackjack.”A natural be ats a score of 21 in three or more cards. Otherwise a score closer to (but less thanor equal to) 21 wins. In most cases equal scores are ties, and neither the dealer nor the player wins.This also applies if both the dealer and the player have blackjack. The exception to the rule is thatif both the dealer and the player go bust, then the dealer wins.The dealer has no choice in how she plays her hand: if her total is 17 or higher, she must stand,and if her total is 16 or less she must hit. If she has an ace and one of the possible totals is greaterthan 16 but less than or equal to 21, then she must stand.2 Program 5Your program should begin by getting the number of players (including the dealer) from the user.It should then deal each player one card at a time until all the players (including the dealer) havetwo cards. After the initial deal is completed the program should show each player’s hand, exceptthat it should hide the dealer’s hole card.It should then begin with the first player and give him the option of hitting (‘h’) or standing(‘s’). This should be repeated until the player stands or goes bust. After each hit, the programshould show the hands of all the players (including the dealer), and it should print the possibletotal(s) for the first player. This proce dure is repeated for each player (other than the dealer).When it’s the dealer’s turn to play, all the hands should be shown and the dealer’s hole cardturned face up. Before playing the dealer’s hand the program should first check whether all theother players have gone bust. If so, the dealer wins against each player, and the program canterminate. If at least one player hasn’t gone bust, the dealer should begin play according to therules described above. When the dealer finishes play, the program should print each player’s score,and who won each hand played against the dealer.13 Some Detail sBefore beginning play, your program should create a deck of 52 cards and shuffle it. If, at any time,it’s necessary to deal a card and the deck is empty, your program should just print a message andquit.You should use the Python code play_cards0.py on the class website for some of the code: ithas functions for printing a card, creating a deck, shuffling a deck, and creating a list of possiblevalues for a hand.4 Due DateIn order to receive full credit, your program must be in the p5 subdirectory of your Subversionrepository by 2:00 pm on Wednesday, December 7, and you must turn in a print out of your programby 5 pm on the 7th.5 GradingYour program will be graded on the basis of its correctness and its “static features.”1. Correctness will be 60% of your grade. Does it correctly show player’s hands? Does it correctlycarry out the player’s instructions? Does it handle busts correctly? Does it correctly evaluateeach player’s total?2. The following static features will be graded.(a) Documentation will be 10% of your grade. Does your header documentation includethe author’s name, the purpose of the program, and a description of how to use theprogram? Are the identifiers meaningful? Are any obscure constructs clearly explained?(b) Source format will be 5% of your grade. Is the indentation consistent? Have blank linesbeen used so that the program is easy to read?(c) Quality of solution will be 20% of your grade. Does your solution contain unnecessarycalculations? Is your solution too clever — e.g., has the solution been condensed to thepoint where it’s incomprehensible? Are functions and data structures (e.g., lists, strings,dictionaries) used properly? Are any functions (including the main program) more than20 lines long?6 CollaborationIt is OK for you to discuss solutions to this program with your classmates. However, no collaborationshould ever involve looking at one of your classmate’s source programs! It is usually extremely easyto determine that som eone has copied a program, even when the indivdual doing the copying haschanged identifiers and comments. If we discover that someone has copied a program, the authorsof both programs will receive an F in the c


View Full Document

USF CS 110 - Programming Assignment 5

Download Programming Assignment 5
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Programming Assignment 5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Programming Assignment 5 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?