473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help me out please...

hi...did anyone know how to do this assignment? cuz, i have run out of time really need ppls help me out thank you if you know it...

Blackjack
For the third assignment you will write a program that allows the user to play the card game Blackjack vs the computer controlled dealer.

Here's an example run.
and another.


The basic goal of Blackjack is to get a hand worth 21 or as close to 21 as possible without going over. A round of Blackjack works as follows.
The hands are dealt. The player and dealer each get two cards. The first and third cards go to the player, the second and fourth go to the dealer.
The player can see both of their cards, but only one of the dealer's cards
The player can take a card (Hit) as many times as needed. However, if the player's hand goes over 21, this is called a Bust and he automatically loses a point
If the player didn't bust, the dealer's hand is played. The dealer follows a strict rule: If the hand is worth 16 points or less, the dealer must keep hitting. If the dealer busts, the player wins a point.
If neither bust, the player wins if their hand is worth more than the dealer's, loses if worth less, and ties (pushes) otherwise
After each round the player is asked if they want to continue. If before a round there are less than 52 cards remaining in the deck, a new deck must be shuffled for the next round.


cards module
To write this program you will need to use the cards module. Go here for information and to download it. Save the file to the same directory as your program and have import cards as the first line of your program. Read the documentation to understand the module's various functions.


User Input
For all of the user input the user will be asked to enter single letters, (Y/N) or (H/S). In all cases the user should be allowed to enter either the upper or lower case letter. If the user enters something else, just repeat the prompt until they give a correct input.
Your hand: 7C 9C
Would you like to (H)it or (S)tand?
Would you like to (H)it or (S)tand? asd
Would you like to (H)it or (S)tand? hil
Would you like to (H)it or (S)tand? H
You drew the queen of spades

Functions
Once again, using functions is going to be an important part of this program. Below are definitions for some functions that you need to write and use in your program. If you don't follow the definitions below, you will lose points even if your program works correctly.

shuffledDeck()
shuffledDeck will take no arguments and return a deck that will be used to deal the cards. This deck will contain two full decks of cards shuffled together. Therefore it will contain 104 cards. The order of the cards needs to be copmletely randomized. You will need to use the random module in order to accomplish this. The function should print the message 'Shuffling' so the player knows this is occuring You may not use the shuffle method in the random module, just the functions that give you random numbers.

handValue(hand)
Write a function named handValuethat takes one argument as input. This argument will be a hand (list) of cards. It will return the value of the hand by summing the value of each of the cards. For those who may be unfamiliar, the cards' values are as follows:
Ace: 1 or 11
2 - 10: Face value, 2 thru 10 respectively
Face Cards (J,Q,K): 10
If the hand does not contain an ace, return the sum. If the hand contains an ace, you will get two values. If the higher value is less than or equal to 21, return it, otherwise return the lower value. For example, a hand of an ace and a ten should return 21, but a hand holding an ace, a five, and a ten should return 16.

playRound(deck)
The playRound function takes one input, the deck of cards that haven't been played. The function will play one round between the dealer and the player and will return the change in the player's score that resulted from the round as an integer, 0, 1, or -1. Below are examples of the output from four calls to playRound. The player busts in the first, pushes in the second, wins the third, and loses the fourth. Note where the long and short names of the cards are used; your program should match this exactly.
The dealer has a eight of diamonds showing.

Your hand: 9H 7C
Would you like to (H)it or (S)tand? h
You drew the jack of hearts

BUST Your hand has a value of 26
You lose a point.




The dealer has a three of hearts showing.

Your hand: 8H QH
Would you like to (H)it or (S)tand? s
Your hand has a value of 18

The dealer has: 3H 6S
The dealer drew the nine of hearts
The dealer's hand has a value of 18
Push




The dealer has a eight of hearts showing.

Your hand: 5D 3S
Would you like to (H)it or (S)tand? h
You drew the five of spades

Your hand: 5D 3S 5S
Would you like to (H)it or (S)tand? h
You drew the six of hearts

Your hand: 5D 3S 5S 6H
Would you like to (H)it or (S)tand? s
Your hand has a value of 19

The dealer has: 8H 9C
The dealer's hand has a value of 17
You win a point.




The dealer has a ace of hearts showing.

Your hand: 7S KH
Would you like to (H)it or (S)tand? s
Your hand has a value of 17

The dealer has: AH 8C
The dealer's hand has a value of 19
You lose a point.


Along with these functions, you must define and use at least 2 other functions in your program. You will lose points if the functions aren't useful.




Notes
Do not try to write the entire program at once. Write a function at a time and once you have each function working, move on.

Coding style will be an important part of the grade. Functions should have docstrings, there should be a helpful comments when it seems appropriate (NOT everywhere), use good variable names, use proper spacing, and any other style issues mentioned in class.
Jul 11 '07 #1
5 1381
bartonc
6,596 Expert 4TB
Please see a very appropriate response in your other post. It's all about following the Posting Guidelines.
Jul 11 '07 #2
come up man just help me out anyone???? please...please..please.
Jul 16 '07 #3
Just hope that Mr. Schmidt doesn't see this, I don't think you're supposed to get other people to do your assignment for you.

Oh PS, next time don't lie either. This assignment is due on the 20th so "I ran out of time" is such BS.

While you're getting others to do your assignment for you, don't forget we're not supposed to use globals in it.

BTW you just copy pasted the text? What about the modules and examples run you didn't link. Tsk tsk
Jul 16 '07 #4
bartonc
6,596 Expert 4TB
come up man just help me out anyone???? please...please..please.
So sorry. I've just discovered that the link I gave is broken.

Here is the link to your original post.
Jul 17 '07 #5
bartonc
6,596 Expert 4TB
come up man just help me out anyone???? please...please..please.
And when you have a question that is not a homework assignment, please tell us what programming language that you are using (there are so many).
Jul 17 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
12
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
17
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will...
7
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.