I started studying C++ and Object Oriented Programming recently, so I decide to create a small poker game, Texas Hold’em style. It took me three days and 670 lines of code, which I don’t think is too bad given it simulates a complete poker game for one human player against 5 computer players.
The fact that I implemented some simplifications probably helped. For instance, there’s only one bind, and after the bind is placed betting starts from zero. Players can only bet or call, but can’t raise a previous bet. Additionally there’s always a winning hand (on real poker sometimes you have a tie and the pot is split). Other than that I tried to preserve the game play as much as possible.
There’s even some ASCII art so it doesn’t look so boring. Here’s the entrance:
And another screenshot of the game play:
If you want to download it here’s the source code in C++. I haven’t found any bugs that crash the program unexpectedly, but there might still be some game play bugs.
Hands compare is not true. Example hands: AsAcAd5h4h+KdQd is equal with AsAcAd5h4h+Ks9s
No any incapsulation. to hard to read and use in other aplications.
Real game is some harder to write. incomplete raise, side pots.
i download ur poker code,but i find a error that ,sleep is not defined in line 58,75,176,,314,530,572,667