Visual C++ Poker Game Needed

Started by
10 comments, last by dointhings 22 years, 5 months ago
I am a newbee C++ Programmer, and really need a basic 5 card draw poker game (not video poker). If anyone can help me out with this, I''d really appreciate it! I have found all kinds of JAVA poker games, but none in C++.
Advertisement
what do you need it for?

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
I am in my first C++ class and have been putting in 20+ hours a week in homework - just to keep up. A very complex variation of this poker game is to be the final project - of which I have no clue where to start.

Our teacher has 10+ years of coding experience, but no teaching experience. I know he is trying, but I am not catching on quick enough (no review or in-class exercises).

I work full-time as a programmer in 2 other languages (Associates Degree with 3.75 GPA), but cannot ''get'' this one. Everyone in the class is lost.

I think if I have just the base to start with, I should be OK to add in the rest of the functionality by researching other textbooks. With this base - I will need to add in the computer partner, other types of games (5 card stud etc), variations on the way the game is dealt, etc etc.

So far we have not even covered files (i/o modules) at all, and have just started working with classes and such. The class is over with in a month. We will not have any class-time to work on this - nor can we team up to split up the work. I know most are just going to blow off the project and hope for the best - but I think this will be a good learning opportunity - if I can actually compile something like this and walk through it. Then I can add in the functionality, and get a better understanding of how this language should work.

If anyone can help with this, I would really appreciate it. I usually pick up these types of things very quickly, and was hoping to be able to use this language in my job. But now I am just hoping to pass the class. I will then need to go back and try to teach myself with some on-line tutorials or something before I will be able to use it.
quote:Original post by Anonymous Poster
I work full-time as a programmer in 2 other languages (Associates Degree with 3.75 GPA), but cannot ''get'' this one.

No offense, but what languages are those? If they aren''t methodologically similar then the knowledge sometimes becomes a hinderance because you expect similarity. Again, this may not refer to you, but my point is that there isn''t necessarily a correlation.

That said, I personally know of no source code poker games, but I do recommend you search at SourceForge. Also, if your class is only just being introduced to classes this late in the semester, perhaps you should complain to the appropriate authorities so you are properly compensated and so you aren''t graded based on what you haven''t been taught.


I wanna work for Microsoft!
A similar thing once happened with a new instructor in the intro C++ course at my university. Every student (And there were 100-150 of them) was offered a free retake of the class, after enough complained to administration.
i will write the program for you if you mail me your degree.

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
I dont know if this would help or not (are you having problems learning the C++ syntax, do you know C?), but I would approach it like this:

* Start by creating a ''Card'' class, which stores only the value and the suit (enum)

* Maybe have a ''Deck'' class which is obviously 52 ''Cards'', and is used to make sure no duplicate cards are dealt. Probably have one function "Shuffle"

* Then have a ''Hand'' class, which has 5 ''Cards'', and functions like "ReplaceCardFunction", "FillHandFunction" (from the ''Deck'') and "HowGoodIsMyHandFunction", etc.


Then the actual program is arbitrary, create an instance of ''Deck'' and x amount of ''Hands'' and it''s a piece of cake. This program is really easy in C, using arrays and structures, but since your class is C++ you are no doubt expected to use classes, which makes it a little tricky with the interactions between classes. I have done this in C and had no trouble, except the AI was the biggest hassle (what should I go for: 3 of a kind or a straight? should IK keep the 5 of clubs or not?)
quote:Original post by Ibanez
I have done this in C and had no trouble, except the AI was the biggest hassle (what should I go for: 3 of a kind or a straight? should IK keep the 5 of clubs or not?)

actually, it isn''t that bad (theoretically; i haven''t tried it yet but listen anyway)...
there are tables available of the probability of each hand turning up, which you could code into the program. the computer AI would have an advantage, as it could easily remember which cards were already seen, to adjust the probabilities (even without "cheating"; it would just have a perfect memory).
Then, it could weigh the bet versus the probability it will get the good hand versus the probability the other player(s) hand(s) being better.


--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
quote:Original post by Anonymous Poster
A similar thing once happened with a new instructor in the intro C++ course at my university. Every student (And there were 100-150 of them) was offered a free retake of the class, after enough complained to administration.


Actually that is exactly what is going on now. I hope something can be done. Last night I talked with an analyst in our class (who programs in about 7 different languages) who is also lost. So I don''t feel quite so incompetent now. I am hoping for the best.
there are tables available of the probability of each hand turning up, which you could code into the program. the computer AI would have an advantage, as it could easily remember which cards were already seen, to adjust the probabilities (even without "cheating"; it would just have a perfect memory).
Then, it could weigh the bet versus the probability it will get the good hand versus the probability the other player(s) hand(s) being better.


--- krez (krezisback@aol.com)

I have no clue what you are talking about when you refer to "AI". That has not been addressed in our class yet either. Could you elaborate on this topic?

This topic is closed to new replies.

Advertisement