CSCE 101: Introduction to Computer Concepts



Lab 12: Black Jack (Simplified)Academic HonestyThe work you turn in is to be your work, not copied from someone else, from the web, or generated by a program.Never allow anyone access to your files.Never give anyone your password.Never share your USB memory or email your files to anyone else.Never give anyone a printed copy of your file or an electronic copy.Never allow anyone to copy your work.PurposeThis lab will let us practice calling functions are receiving data back from them.FunctionalityYour program will create a simple version of black jackImplementationCreate 3 arrays1 holds the suites (Diamonds, Hearts, Clubs, Spades)1 holds the face (Ace, King, Queen, Jack, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)1 holds values (1,10,10,10,10,9,8,7,6,5,4,3,2,1)Note: Aces will always have a value of 1Create a function to create a cardPick a random face and suite from the arrays, display the card (print), and return the value of the card, e.g. print “7 of Clubs”, return 7Call the function twice to display the users first two cards, and keep track of the totalThen using a loop, ask them if they want another card:Keep giving them cards, displaying them, and adding to their total, until:The user says they don’t want any more cardsTheir total is >= 21Create a random number between 15 and 21 for the computers numberThe user wins if:They get 21Their number is > the computersThey lose if:They get > 21Their number is < the computersSample Program Losing:Winning:Submitting your filesCopy your .py file and move it to your X:\101Labs directory for grading.Make sure your file is named Lab12XY.py where XY are your initialsPrint your code, and submit it to your lab instructor at the beginning of your next lab class.Grade BreakdownPointsExpectation10%Comments, listing program, your name, and explaining the code30%Create card function: properly creates and returns a random card.60%Game logic working correctly ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download