Simple Poker Game in C++


Improve your writing skills in 5 minutes a day with the Daily Writing Tips email newsletter.

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:

text-poker1

And another screenshot of the game play:

text-poker2

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.

3 thoughts on “Simple Poker Game in C++

  1. nefton

    No any incapsulation. to hard to read and use in other aplications.
    Real game is some harder to write. incomplete raise, side pots.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *