C++ Blackjack program...  | | |
January 18th, 2006, 11:57 PM
|
#1 (permalink)
| | SoMuchAnime-SoLittleTime
Join Date: Aug 2003 Location: Plymouth, WI
Posts: 14,984
|
I am making a blackjack program for school...in C++...and I was wondering if you guys would like to try it out...
The .txt file is the source code if you want to see it...
(it is currently in Beta...because I haven't completely tested everything yet...but I haven't found any more bugs...)
If you do find a bug, could you post a screenshot of it for me? Thanks.
UPDATE: Updated the programs I uploaded...
Last edited by EXreaction : January 21st, 2006 at 07:23 PM.
|
| |
January 19th, 2006, 12:18 AM
|
#2 (permalink)
| | I am a banana!
Join Date: Jun 2002 Location: Texas Tech
Posts: 3,921
|
recommendation: when an invalid response is entered you should print a message saying it was incorrect in addition to re-asking the question. Minor detail, but adds to the usability of the program.
i like how the program automatically calls the round over when you get 21. I don't see any memory leaks either.
bug: when multiple characters are entered at the prompt and enter is then hit, the prompt is printed 3 times. screenshot.
otherwise looks good. |
| |
January 19th, 2006, 12:32 AM
|
#3 (permalink)
| | Senior Member
Join Date: Oct 2002
Posts: 557
|
you cant double down or split or get insurance, kinda not blackjack without em hehe
and tie is called push
oh and the dealer should stay at 17
and it'd be cool to play more than 1 hand at the same time 
Last edited by bfcx : January 19th, 2006 at 12:36 AM.
|
| |
January 19th, 2006, 01:21 AM
|
#4 (permalink)
| | Senior Member
Join Date: Oct 2002
Posts: 557
|
maybe in your if else statements you should use try blocks to throw the errors, cleaner more standardized, might get some easy extra points |
| |
January 19th, 2006, 09:11 AM
|
#5 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Augsburg, Germany
Posts: 5,586
|
Complaints:
* For "play again", don't recurse main(). Loop what's inside main() on the basis of the result of PlayAgain().
* CardValue(): Use switch/case rather than a chain of if/else.
* As I said, eliminate global variables. Pass arguments, return results. Globals make code an unreadable mess. |
| |
January 19th, 2006, 10:49 AM
|
#6 (permalink)
| | Senior Member
Join Date: Oct 2002
Posts: 557
|
ahh, very good points PeterM, i concure  |
| |
January 19th, 2006, 11:33 AM
|
#7 (permalink)
| | Junior Member
Join Date: Jan 2006
Posts: 10
|
u cant double down or split or get insurance, kinda not blackjack without em ........!!!!!11 |
| |
January 19th, 2006, 02:12 PM
|
#8 (permalink)
| | SoMuchAnime-SoLittleTime
Join Date: Aug 2003 Location: Plymouth, WI
Posts: 14,984
| Quote: |
Originally Posted by originel recommendation: when an invalid response is entered you should print a message saying it was incorrect in addition to re-asking the question. Minor detail, but adds to the usability of the program. | Hmm...I could have something like "cout<<hs<<" is not acceptible, please enter a 'h', or a 's'."; Ya, i will see what I can do.  Quote: |
Originally Posted by originel bug: when multiple characters are entered at the prompt and enter is then hit, the prompt is printed 3 times. screenshot. | Ya, I know about when you enter in more than one character that it screws it up...I was hoping to ask my teacher how to fix that...but it took him the whole class period(lots of people had questions about their programs) to get to the person before me today...  Quote: |
Originally Posted by bfcx you cant double down or split or get insurance, kinda not blackjack without em hehe
and tie is called push
oh and the dealer should stay at 17
and it'd be cool to play more than 1 hand at the same time  | Well, it is kinda hard to add in all that extra stuff like splitting, and multiple hands...this does only run in the console...so you can lose track of stuff really easy...or alteast I do when too much is going on. 
Double down...ya, it would be nice, but I don't think it matters when you are not playing for credits, or money...it would just limit you to taking one card...so it isn't practical in the version I have...mabey I will add it in so you can actually bet credits later...then I will add the double down...same with insurance...
Ya, I know it is a push...but I like tied better... I will change that...
Doesn't the dealer stay on 17? On soft 17 he is supposed to hit, but he isn't on a normal 17.  Quote: |
Originally Posted by Peter M Complaints:
* For "play again", don't recurse main(). Loop what's inside main() on the basis of the result of PlayAgain().
* CardValue(): Use switch/case rather than a chain of if/else.
* As I said, eliminate global variables. Pass arguments, return results. Globals make code an unreadable mess. | I think I will change that recursive main...
EDIT: Just have each section call each other...that is what I will do. 
I don't know how to do a switch/case yet. 
Hmm...I love Global variables(we used them all the time in my VB class...so I kinda learned coding using them)...I will look into changing them though. 
...time for me to get to work!
Last edited by EXreaction : January 19th, 2006 at 02:17 PM.
|
| |
January 19th, 2006, 02:18 PM
|
#9 (permalink)
| | Senior Member
Join Date: Oct 2002
Posts: 557
|
global variables should rarely be used in any language, they let you get away with them but there's much better ways of passing the info, and you dont want other functions messing with other functions variables
Ya i was just suggesting features
case switch is perty easy, look it up and get some extra credit  |
| |
January 19th, 2006, 02:29 PM
|
#10 (permalink)
| | SoMuchAnime-SoLittleTime
Join Date: Aug 2003 Location: Plymouth, WI
Posts: 14,984
| Quote: |
Originally Posted by bfcx global variables should rarely be used in any language, they let you get away with them but there's much better ways of passing the info, and you dont want other functions messing with other functions variables
Ya i was just suggesting features
case switch is perty easy, look it up and get some extra credit  | Well, I will remember that! No more gloabals unless they are absolutely needed...
If I do get to adding in betting, I will probably add those extras...but they are not needed now.
Yep, I will do that...if it is anything like it is in VB, it is so easy I might have to do this ->  |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |