Poker Simulator Design Log

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
Line 12: Line 12:
  
 
[[Image: Poker Class Diamgram 2.png]]
 
[[Image: Poker Class Diamgram 2.png]]
 +
 +
I'm hoping this design will allow me to utilize more design patterns. I have a [[Strategy]] pattern for the different DealStyles - for a HoldEm game each player is dealt only 2 cards, and then there are a total of 5 community cards dealt face up on the table that everyone can use. For a Draw game, each player is dealt 5 cards, there are no community cards, and then each player can discard selected cards from their hand and get new cards dealt to them, making up a 5 card hand again.

Revision as of 01:11, 3 September 2008

Poker Simulator Design

For my design study I have chosen to create a poker simulator. Cards are dealt to a number of players around a table, and the winner of the hand determined. The game can continue for an arbitrary number of hands. Initially there will be no player input or AI, but I will leave the design open for extending it to a full blown poker game. The two variants of poker I am initially implementing are Texas Hold'em and 5 Card Draw, but I am leaving the design open for other variants, eg Omaha, 5 Card Stud etc.

I am also looking at implementing different limits - the most common is no limit where you can bet however much you like at any time, even your entire chip stack. There are also limit games where bets and raises are limited to a fixed amount, and pot limit where bets are limited to the size of the pot. I might also allow for different poker games - cash tables and tournaments. So far I think my design can allow for both.

Here is my initial (incomplete) class diagram. Right now it seems to be a mess of compositions. I'm wondering if this idea will be any good for showing design patterns, hmmm.

Original attempt

I have greatly improved on the original design, here is take 2:

Poker Class Diamgram 2.png

I'm hoping this design will allow me to utilize more design patterns. I have a Strategy pattern for the different DealStyles - for a HoldEm game each player is dealt only 2 cards, and then there are a total of 5 community cards dealt face up on the table that everyone can use. For a Draw game, each player is dealt 5 cards, there are no community cards, and then each player can discard selected cards from their hand and get new cards dealt to them, making up a 5 card hand again.

Personal tools