首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
COMP 1043编程设计讲解、Python程序语言辅导 调试Matlab程序|讲解SPSS
项目预算:
开发周期:
发布时间:
要求地区:
UO Problem Solving and Programming
Programming Assignment 3
Introduction
This document describes the first assignment for Problem Solving and Programming.
The assignment is intended to provide you with the opportunity to put into practice what you have learnt in the course by applying your knowledge and skills to implement a game of Blackjack.
This document is a kind of specification of the required end product that will be generated by implementing the assignment. Like many specifications, it is written in English and hence will contain some imperfectly specified parts. Please make sure you seek clarification if you are not clear on any aspect of this assignment.
Assignment Overview
You are required to write a Python program that allows a player to play a game of Blackjack against the computer. The program will allow a player to play as many games of Blackjack as they wish.
Blackjack
Blackjack is a popular card game where the goal is to beat the dealer by having the higher hand which does not exceed 21. https://en.wikipedia.org/wiki/Blackjack.
Although there are many variations of the rules and game play, we will be adhering to the following rules and game play for the assignment.
Blackjack hands are scored by their point total, calculated by adding together the face values of each card dealt. The hand with the highest total wins, as long as it doesn’t exceed 21. A hand with a higher total than 21 is said to bust. Being dealt an Ace (of any suit) counts as eleven (11) points unless this would cause the player to bust, in which case it is worth one (1) point. Picture cards (King, Queen and Jack) are all worth 10 points. All other cards are worth their numerical value shown on the card.
Blackjack game play:
To begin, the player and the dealer are dealt an initial hand of two cards each.
If the dealer has Blackjack (the first two cards dealt total 21 points) and the player does not, the dealer automatically wins.
If the player has Blackjack (the first two cards dealt total 21 points) and the dealer does not, the player automatically wins.
If both the player and the dealer have Blackjack (the first two cards dealt total 21 points) then it is a push (draw).
If neither have Blackjack, then the player plays out his/her hand. Note that the term Blackjack can only be achieved as a result of the first two cards dealt.
When the player has finished playing out his/her hand, the dealer (in this case the computer) plays out the dealer’s hand.
During the player’s turn, the player is faced with two options either:
1.Hit (take a card):
After the initial deal of two cards, a player may choose to receive additional cards as many times as he/she wishes, adding the point value of each card to his/her hand total.
2.Stand (end their turn):
Do not receive any more cards. The player’s turn is over.
The player repeatedly takes a card until, the player chooses to stand, or the player busts (that is, exceeds a total of 21). The player’s turn is over after deciding to stand or if he/she busts.
Once the player has finished, the dealer plays out his/her hand (in this case the computer), revealing the hidden second card amount. Note: the dealer always plays his/her hand regardless of what happens with the player’s hand. The dealer must hit until he or she has a point value of 17 or greater.
Blackjack rules:
If the player busts, he/she loses even if the dealer also busts.
If the player and the dealer have the same point value, it is called a ‘push’ and neither win the hand (draw).
An initial two-card deal of 21 (an 11 plus a 10) is called Blackjack (i.e. an 11 plus a 10 is dealt as the very first hand) and wins the round automatically.
An Ace counts as eleven (11) points unless this would cause the player/dealer to bust, in which case it is worth one (1) point.
House rules:
The dealer must hit until he or she has a point value of 17 or greater.
The player can not stand on a point value less than 15.
The player with the higher hand that does not exceed 21 wins the game!
You do not have to write the code that deals one card at a time, a module containing the function that does that for you has been provided. The playing_cards.py file is a module that contains a function called deal_one_card() that deals one card at a time for you. The function returns a string (containing two characters) that represents a card; the first letter represents the face value of the card and the second letter represents the suit. For example: it may return the two character string ‘AH’, where ‘A’ represents Ace and ‘H’ represents Hearts; ‘TC’, where ‘T’ represents Ten and ‘C’ represents Clubs, ‘7S’, where ‘7’ represents the card value of 7 and ‘S’ represents Spades, etc. You are required to use this as part of this assignment, however, please do not modify the playing_cards.py file. There are other functions within the module that create the playing deck, and shuffle it, but you do not have to worry about those functions, you only have to make use of the deal_one_card() function in your solution, the other functions will take care of the rest for you! : )
Practical Requirements
It is recommended that you develop this assignment in the suggested stages.
It is expected that your solution MUST include the use of the following:
Your solution in a file called your_email_id.py.
The supplied playing_cards.py module (containing the deal_one_card() function). This is provided for you – please DO NOT modify this file.
The deal_one_card() function (provided in the supplied playing_cards.py module).
Appropriate and well constructed while and/or for loops (as necessary).
Appropriate if, if-else, if-elif-else statements (as necessary).
List of strings to represent the player’s hand, i.e. player_hand = []
List of strings to represent the dealer’s hand, i.e. dealer_hand = []
Practical requirements (continued)… Your solution MUST include the use of the following:
The following functions:
odisplay_details()
This function takes no parameters and does not return any values. The function displays your details to the screen. Remember that defining the function does not execute the function – you will need to call the function from the appropriate place in the program. Your function should produce the following output (with your details) to the screen:
File : wayby001.py
Author : Batman
Stud ID : 0123456X
Email ID : wayby001
This is my own work as defined by the University's Academic Misconduct Policy.
oget_hit_choice()
This function takes no parameters and returns the user’s choice, whether to hit (‘h) or stand (‘s). The function prompts for, reads and validates the user’s choice to either hit or stand.
oget_play_choice(prompt_text)
This function takes a string (the prompt text) to display to the screen as a parameter and returns the users choice, whether to play again, i.e. ‘y’ or ‘n’. The function prompts for, reads and validates the user’s choice to keep playing (‘y’) or stop playing (‘n’).
odiplay_hand(hand_text, hand)
This function takes a string (hand text) to display to the screen and a list of strings (hand) containing the cards dealt. The function does not return any values and displays the hand (list) to the screen in the following format, for example:
If the player_hand list is as follows,
player_hand = ['4D', 'TS', 'KD']
calling the display_hand() function like so
display_hand('\nPlayer\'s hand is', player_hand)
will produce the following output to the screen:
Player's hand is 24: 4 of Diamonds | 10 of Spades | K of Diamonds
If the dealer_hand list is as follows,
dealer_hand = ['KS', '9C']
calling the display_hand()function like so
display_hand('\nDealer\'s hand is', dealer_hand)
will produce the following output to the screen:
Dealer's hand is 19: K of Spades | 9 of Clubs
This function must call function get_hand_total(hand).
oget_hand_total(hand)
This function takes a list of strings (containing the cards dealt) and calculates the point value of the hand. The function returns the total point value of the hand.
oplay_player_hand(player_hand)
This function takes a list of strings (containing the cards dealt) and returns the total point value of the player’s hand. The function plays out the player’s hand until the player either busts or chooses to stand. Do not let the player stand on a value less than 15 and display the player busts message if the player exceeds 21. The function must call the following functions: get_hit_choice(), get_hand_total(), display_hand() and deal_one_card().
oplay_dealer_hand(dealer_hand)
This function takes a list of strings (containing the cards dealt) and returns the total point value of the dealer’s hand. The function plays out the dealer’s hand until the dealer has a point value of 17 or greater. Display the dealer busts message if the dealer exceeds 21.
The function must call the following functions: get_hand_total(), display_hand() and deal_one_card().
Output that strictly adheres to the assignment specifications. If you are not sure about these details, you should check with the ‘Sample Output’ provided at the end of this document.
Good programming practice:
oConsistent commenting, layout and indentation. You are to provide comments to describe: your details, program description, all variable definitions, and every significant section of code.
oMeaningful variable names.
Your solutions MUST NOT use:
break, or continue statements in your solution. Do not use the quit() or exit() functions or the break or return statements (or any other techniques) as a way to break out of loops. Doing so will result in a significant mark deduction.
PLEASE NOTE: You are reminded that you should ensure that all input and output conform to the specifications listed here; if you are not sure about these details you should check with the sample output provided at the end of this document or post a message to the discussion forum in order to seek clarification.
Please ensure that you use Python 3 (current version) in order to complete your assignments. Your programs MUST run using Python 3 (i.e. current version).
Stages
It is recommended that you develop this assignment in the suggested stages. Many problems in later stages are due to errors in early stages. Make sure you have finished and thoroughly tested each stage before continuing.
The following stages of development are recommended:
Stage 1
You will need the playing_cards.py file for this assignment. This has been provided for you. Please download this file from the course website (Assessment tab) and ensure that it is in the same directory as your yourEmailId.py file.
Test to ensure that this is working correctly by entering the following in your yourEmailId.py file:
import playing_cards
card = playing_cards.deal_one_card()
print(card)
Run the yourEmailId.py file. If this is working correctly, you should now see the following output in the Python shell when you run your program:
The function deal_one_card() returns a string (containing two characters) that represents a card; the first letter represents the face value of the card and the second letter represents the suit. For example: it may return the two character string ‘AH’, where ‘A’ represents Ace and ‘H’ represents Hearts; ‘TC’, where ‘T’ represents Ten and ‘C’ represents Clubs, ‘7S’, where ‘7’ represents the card value of 7 and ‘S’ represents Spades, etc. In the above example, the deal_one_card() function returned 6D, where ‘6’ represents the card value of 6 and ‘D’ represents Diamonds, i.e. 6 of Diamonds.
Please note: the two character string returned from the function call to deal_one_card() may differ when you run your code – the deck is shuffled after all! : )
Also, this is for developmental purposes only, and you will need to modify and correctly position the above code.
Make sure the program runs correctly. Once you have that working, back up your program. Note: When developing software, you should always have fixed points in your development where you know your software is bug free and runs correctly.
Stage 2
To begin, the player is dealt two cards. Use the deal_one_card() function to simulate the dealing of the player’s hand. You will need to create a list to store the cards (strings of two characters) returned from the call to function deal_one_card(), i.e. player_hand = []. You may use the append() method in order to add cards to the player_hand list (as seen below). Display the player_hand (list containing the two cards) to the screen.
import playing_cards
player_hand = []
# Deal first card
card = playing_cards.deal_one_card()
# Append it to the player_hand list
player_hand.append(card)
# Deal second card
card = playing_cards.deal_one_card()
# Append it to the player_hand list
player_hand.append(card)
# Display the player's hand to the screen using a simple print statement
print(player_hand)
Sample output:
['4C', '2H']
The above is displayed for testing purposes only. Eventually, when you know your code is working correctly, the player’s hand will be displayed as follows:
Sample output:
Player's hand is 6: 4 of Clubs | 2 of Hearts
Stage 3
To begin, the dealer is also dealt two cards. Use the deal_one_card() function to simulate the dealing of the dealer’s hand. You will need to create a list to store the cards (strings of two characters) returned from the call to function deal_one_card(), i.e. dealer_hand = []. You may use the append() method in order to add cards to the dealer_hand list. Display the dealer_hand (list containing the two cards) to the screen.
Sample output:
['7S', '5D']
The above is displayed for testing purposes only. Eventually, when you know your code is working correctly, the dealer’s hand will be displayed as follows:
Sample output:
Dealer's hand is 12: 7 of Spades | 5 of Diamonds
Stage 4
Implement the function called get_hand_total(hand) – see description under section titled ‘Practical Requirements’. Hint: Function get_hand_total(hand) should use a loop. Display the dealer’s hand and the player’s hand to the screen as seen below. For example:
If the player_hand list is as follows,
player_hand = ['KH', '5C']
calling the get_hand_total(hand) function like so
player_total = get_hand_total(player_hand)
will assign the value of 15 to variable player_total.
If the dealer_hand list is as follows,
dealer_hand = ['TC', '7H']
calling the get_hand_total(hand)function like so
dealer_total = get_hand_total(dealer_hand)
will assign the value of 17 to variable dealer_total.
You can then use a simple print statement to display the player and dealer hand totals along with the lists to the screen as follows:
Sample output:
Dealer hand is: 17 ['TC', '7H']
Player hand is: 15 ['KH', '5C']
The above is displayed for testing purposes only. Eventually, when you know your code is working correctly, the dealer and player hands will be displayed as follows:
Sample output:
Dealer's hand is 17: 10 of Clubs | 7 of Hearts
Player's hand is 15: K of Hearts | 5 of Clubs
Stage 5
Implement the function called display_hand(hand_text, hand) – see description under section titled ‘Practical Requirements’. Hint: Function display_hand(hand_text, hand) should use a loop and call the get_hand_total() function. Display the dealer’s hand and the player’s hand to the screen as seen below. For example:
If the player_hand list is as follows,
player_hand = ['4D', 'TS', 'KD']
calling the display_hand() function like so
display_hand('\nPlayer\'s hand is', player_hand)
will produce the following output to the screen:
Player's hand is 24: 4 of Diamonds | 10 of Spades | K of Diamonds
If the dealer_hand list is as follows,
dealer_hand = ['KS', '9C']
calling the display_hand()function like so
display_hand('\nDealer\'s hand is', dealer_hand)
will produce the following output to the screen:
Dealer's hand is 19: K of Spades | 9 of Clubs
Stage 6
Include code to check for Blackjack on the initial deal of two cards for both the player and dealer.
If the dealer has Blackjack (the first two cards dealt total 21 points) and the player does not, the dealer automatically wins.
If the player has Blackjack (the first two cards dealt total 21 points) and the dealer does not, the player automatically wins.
If both the player and the dealer have Blackjack (the first two cards dealt total 21 points) then it is a push (draw).
Sample output 1:
Dealer's hand is 10: Q of Diamonds
Player's hand is 15: 5 of Hearts | J of Diamonds
Dealer's hand is 21: Q of Diamonds | A of Hearts
*** Blackjack! Dealer Wins! ***
Sample output 2:
Dealer's hand is 4: 4 of Hearts
Player's hand is 21: A of Clubs | Q of Clubs
*** Blackjack! Player Wins! ***
Sample output 3:
Dealer's hand is 11: A of Clubs
Player's hand is 21: K of Hearts | A of Diamonds
*** Blackjack --
Dealer's hand is 21: A of Clubs | J of Spades
Player's hand is 21: K of Hearts | A of Diamonds
*** Blackjack! Push - no winners! ***
Sample output 4:
Dealer's hand is 10: J of Diamonds
Player's hand is 17: 7 of Clubs | K of Diamonds
Play out player's hand... coming soon... :)
If neither have Blackjack, then the player plays out his/her hand - don’t implement this just yet, simply display a message to the screen (as seen above in sample output 4).
Stage 7
Okay, now let’s include code to play out the player’s hand. Prompt for and read whether the player would like to hit (‘h’) or stand (‘s’). Implement a loop which continues to simulate one card being dealt until the user enters stand (‘s’). Display the player’s hand and the total hand value to the screen as seen below.
Sample output:
Dealer's hand is 10: Q of Diamonds
Player's hand is 18: A of Diamonds | 7 of Clubs
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 22: A of Diamonds | 7 of Clubs | 4 of Spades
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 27: A of Diamonds | 7 of Clubs | 4 of Spades | 5 of Hearts
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 29: A of Diamonds | 7 of Clubs | 4 of Spades | 5 of Hearts | 2 of Spades
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 38: A of Diamonds | 7 of Clubs | 4 of Spades | 5 of Hearts | 2 of Spades | 9 of Diamonds
Please enter h or s (h = Hit, s = Stand): s
You may like to implement the function called play_player_hand() at this point or you may like to come back to it once you have the player playing out his/her hand correctly – the decision is yours.
Stage 8
It does not make sense to continue rolling when the player busts (exceeds 21). Modify the loop developed in the previous stage so that it also stops looping if the player busts (exceeds 21).
Sample output:
Dealer's hand is 4: 4 of Diamonds
Player's hand is 11: 5 of Clubs | 6 of Hearts
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 13: 5 of Clubs | 6 of Hearts | 2 of Clubs
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 19: 5 of Clubs | 6 of Hearts | 2 of Clubs | 6 of Clubs
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 29: 5 of Clubs | 6 of Hearts | 2 of Clubs | 6 of Clubs | 10 of Clubs
--> Player busts!
Stage 9
Now let’s add a loop which simulates the computer’s turn. That is, plays out the dealer’s (computer’s) hand.
Sample output 1:
Dealer's hand is 10: 10 of Diamonds
Player's hand is 9: 2 of Diamonds | 7 of Diamonds
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 11: 2 of Diamonds | 7 of Diamonds | 2 of Clubs
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 20: 2 of Diamonds | 7 of Diamonds | 2 of Clubs | 9 of Diamonds
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 20: 10 of Diamonds | J of Diamonds
Sample output 2:
Dealer's hand is 4: 4 of Clubs
Player's hand is 9: 3 of Spades | 6 of Diamonds
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 15: 3 of Spades | 6 of Diamonds | 6 of Clubs
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 17: 3 of Spades | 6 of Diamonds | 6 of Clubs | 2 of Hearts
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 14: 4 of Clubs | K of Clubs
Dealer's hand is 24: 4 of Clubs | K of Clubs | J of Spades
--> Dealer busts!
You may like to implement the function called play_dealer_hand() at this point or you may like to come back to it once you have the dealer playing out his/her hand correctly – the decision is yours.
Stage 10
Add code which determines the winner and displays the result to the screen.
Sample output 1:
Dealer's hand is 10: K of Hearts
Player's hand is 20: A of Clubs | 9 of Diamonds
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 20: K of Hearts | 10 of Hearts
--- Dealer: 20 Player: 20 -> Push - no winners! ---
Sample output 2:
Dealer's hand is 10: K of Spades
Player's hand is 16: Q of Diamonds | 6 of Clubs
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 20: K of Spades | Q of Hearts
--- Dealer: 20 Player: 16 -> Dealer Wins! ---
Sample output 3:
Dealer's hand is 11: A of Spades
Player's hand is 11: 6 of Diamonds | 5 of Diamonds
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 19: 6 of Diamonds | 5 of Diamonds | 8 of Diamonds
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 14: A of Spades | 3 of Diamonds
Dealer's hand is 17: A of Spades | 3 of Diamonds | 3 of Hearts
--- Dealer: 17 Player: 19 -> Player Wins! ---
Stage 11
Add code that ensures that the player can not stand (‘s’) on a hand value of less than 15. Notice that the player automatically rolls again when this happens (see sample output below).
Sample output:
Dealer's hand is 10: Q of Diamonds
Player's hand is 14: 7 of Spades | 7 of Diamonds
Please enter h or s (h = Hit, s = Stand): s
Cannot stand on value less than 15!
Player's hand is 24: 7 of Spades | 7 of Diamonds | J of Hearts
--> Player busts!
Dealer's hand is 19: Q of Diamonds | 9 of Clubs
--- Dealer: 19 Player: 24 -> Dealer Wins! ---
Stage 12
Add yet another loop that asks the player whether they wish to play again ['y'|'n'].
Stage 13
Add code to keep track of how many games were played, how many were won, lost and drawn. Display this to the screen.
Stage 14
Add code to validate all user input. Hint: use a while loop to validate input. Implement the following functions:
oget_hit_choice()
This function takes no parameters and returns the user’s choice, whether to hit (‘h) or stand (‘s). The function prompts for, reads and validates the user’s choice to either hit or stand.
oget_play_choice(prompt_text)
This function takes a string (the prompt text) to display to the screen as a parameter and returns the users choice, whether to play again, i.e. ‘y’ or ‘n’. The function prompts for, reads and validates the user’s choice to keep playing (‘y’) or stop playing (‘n’).
Sample output:
Would you like to play BlackJack [y|n]? p
Would you like to play BlackJack [y|n]? t
Would you like to play BlackJack [y|n]? y
Dealer's hand is 10: K of Diamonds
Player's hand is 10: 3 of Diamonds | 7 of Hearts
Please enter h or s (h = Hit, s = Stand): z
Please enter h or s (h = Hit, s = Stand): j
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 13: 3 of Diamonds | 7 of Hearts | 3 of Clubs
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 23: 3 of Diamonds | 7 of Hearts | 3 of Clubs | J of Spades
--> Player busts!
Dealer's hand is 15: K of Diamonds | 5 of Diamonds
Dealer's hand is 25: K of Diamonds | 5 of Diamonds | K of Spades
--> Dealer busts!
--- Dealer: 25 Player: 23 -> Dealer Wins! ---
That was fun!
Play again [y|n]? e
Play again [y|n]? b
Play again [y|n]? n
You played 1 games!
-> Won: 0
-> Lost: 1
-> Drawn: 0
Stage 15
Finally, check the sample output (see section titled ‘Sample Output’ towards the end of this document) and if necessary, modify your code so that:
The output produced by your program EXACTLY adheres to the sample output provided.
Your program behaves as described in these specs and as the sample output provided.
Submission Details
You are required to do the following in order to submit your work and have it marked:
oYou are required to save your .py file(s) of Assignment 3 including all supplied files into a single zip file with file name uopsp_assignment3_username.zip, where username is your university network username / email ID (e.g. karsy028) and submit your zip file via the submission point by Monday, 07 June (Week 10), 12:00 PM (Adelaide time).
Ensure that your files are named correctly (as per instructions outlined in this document).
Ensure that the following file is included in your submission:
your_email_id.py
For example (if your name is James Bond, your submission files would be as follows):
bonjy007.py
All files that you submit must include the following comments.
#
# File: fileName.py
# Author: your name
# Email Id: your email id
# Description: Assignment 2 – place assignment description here…
# This is my own work as defined by the University's
# Academic Misconduct policy.
#
Assignments that do not contain these details may not be marked.
It is expected that students will make copies of all assignments and be able to provide these if required.
Sample Output
Sample output 1:
File : wayby001.py
Author : Batman
Stud ID : 0123456X
Email ID : wayby001
This is my own work as defined by the University's Academic Misconduct Policy.
Would you like to play BlackJack [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 3: 3 of Clubs
Player's hand is 9: 5 of Clubs | 4 of Clubs
Please enter h or s (h = Hit, s = Stand): s
Cannot stand on value less than 15!
Player's hand is 19: 5 of Clubs | 4 of Clubs | Q of Clubs
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 14: 3 of Clubs | A of Clubs
Dealer's hand is 20: 3 of Clubs | A of Clubs | 6 of Hearts
--- Dealer: 20 Player: 19 -> Dealer Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 4: 4 of Hearts
Player's hand is 20: K of Diamonds | J of Hearts
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 9: 4 of Hearts | 5 of Hearts
Dealer's hand is 19: 4 of Hearts | 5 of Hearts | J of Diamonds
--- Dealer: 19 Player: 20 -> Player Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 4: 4 of Diamonds
Player's hand is 15: 4 of Spades | A of Spades
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 25: 4 of Spades | A of Spades | Q of Diamonds
--> Player busts!
Dealer's hand is 15: 4 of Diamonds | A of Hearts
Dealer's hand is 17: 4 of Diamonds | A of Hearts | 2 of Spades
--- Dealer: 17 Player: 25 -> Dealer Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 10: Q of Spades
Player's hand is 20: J of Spades | 10 of Clubs
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 17: Q of Spades | 7 of Diamonds
--- Dealer: 17 Player: 20 -> Player Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 2: 2 of Hearts
Player's hand is 15: J of Clubs | 5 of Spades
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 21: J of Clubs | 5 of Spades | 6 of Spades
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 12: 2 of Hearts | Q of Hearts
Dealer's hand is 22: 2 of Hearts | Q of Hearts | 10 of Diamonds
--> Dealer busts!
--- Dealer: 22 Player: 21 -> Player Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? n
You played 5 games!
-> Won: 3
-> Lost: 2
-> Drawn: 0
Thanks for playing! :)
Sample output 2:
File : wayby001.py
Author : Batman
Stud ID : 0123456X
Email ID : wayby001
This is my own work as defined by the University's Academic Misconduct Policy.
Would you like to play BlackJack [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 4: 4 of Clubs
Player's hand is 9: 6 of Clubs | 3 of Spades
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 19: 6 of Clubs | 3 of Spades | Q of Hearts
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 9: 4 of Clubs | 5 of Hearts
Dealer's hand is 17: 4 of Clubs | 5 of Hearts | 8 of Clubs
--- Dealer: 17 Player: 19 -> Player Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 10: Q of Clubs
Player's hand is 12: A of Hearts | A of Diamonds
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 20: A of Hearts | A of Diamonds | 8 of Spades
Please enter h or s (h = Hit, s = Stand): s
Dealer's hand is 12: Q of Clubs | 2 of Spades
Dealer's hand is 15: Q of Clubs | 2 of Spades | 3 of Clubs
Dealer's hand is 25: Q of Clubs | 2 of Spades | 3 of Clubs | K of Hearts
--> Dealer busts!
--- Dealer: 25 Player: 20 -> Player Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? n
You played 2 games!
-> Won: 2
-> Lost: 0
-> Drawn: 0
Thanks for playing! :)
Sample output 3:
File : wayby001.py
Author : Batman
Stud ID : 0123456X
Email ID : wayby001
This is my own work as defined by the University's Academic Misconduct Policy.
Would you like to play BlackJack [y|n]? p
Would you like to play BlackJack [y|n]? t
Would you like to play BlackJack [y|n]? y
---------------------- START GAME ----------------------
Dealer's hand is 7: 7 of Diamonds
Player's hand is 15: 4 of Spades | A of Hearts
Please enter h or s (h = Hit, s = Stand): o
Please enter h or s (h = Hit, s = Stand): y
Please enter h or s (h = Hit, s = Stand): h
Player's hand is 22: 4 of Spades | A of Hearts | 7 of Clubs
--> Player busts!
Dealer's hand is 17: 7 of Diamonds | 10 of Diamonds
--- Dealer: 17 Player: 22 -> Dealer Wins! ---
----------------------- END GAME -----------------------
That was fun!
Play again [y|n]? z
Play again [y|n]? w
Play again [y|n]? y
---------------------- S
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做 program、代写 c++设计程...
2024-12-23
comp2012j 代写、代做 java 设...
2024-12-23
代做 data 编程、代写 python/...
2024-12-23
代做en.553.413-613 applied s...
2024-12-23
代做steady-state analvsis代做...
2024-12-23
代写photo essay of a deciduo...
2024-12-23
代写gpa analyzer调试c/c++语言
2024-12-23
代做comp 330 (fall 2024): as...
2024-12-23
代写pstat 160a fall 2024 - a...
2024-12-23
代做pstat 160a: stochastic p...
2024-12-23
代做7ssgn110 environmental d...
2024-12-23
代做compsci 4039 programming...
2024-12-23
代做lab exercise 8: dictiona...
2024-12-23
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!