title: Game architecture and design strategy for a multiplayer card game
body: <p>I am relatively new to game development so I decided I wanted to create a hobby project from scratch for both experience and entertainment.  The specific game is similar to poker known as <a href="http://en.wikipedia.org/wiki/Three_card_brag" rel="nofollow noreferrer">Three Card Brag</a>. The game is played in the movie <em>Lock, Stock and Two Smoking Barrels</em>.</p>
  
  <p>I have been reading up on some of the topics on SO regarding game development, though mostly <a href="https://stackoverflow.com/questions/361002/any-patterns-for-modelling-board-games">this question</a>.  This has helped revamp the original way I was creating the objects.  </p>
  
  <p>One particular problem I am having is defining game state. My initial approach was to separate everything (e.g. keeping chip stacks inside a <code>Player</code> class) but after reading the responses to the <a href="https://stackoverflow.com/questions/361002/any-patterns-for-modelling-board-games">question</a> I mentioned previously, it seems as though all possible states of the game should be maintained within a <code>GameState</code> object.  What I came up with is essentially this:</p>
  
  <pre><code>abstract class CardGameState
  {
      protected List&lt;Player&gt; _Players;
      protected Player _CurrentPlayer;
      protected Dictionary&lt;Player, int&gt; _Chips;
      protected Dictionary&lt;Player, Hand&gt; _CurrentHand;
      protected Dictionary&lt;Player, PlayerStatuses&gt; _PlayerStatus; // PlayerStatuses.InHand, PlayerStatuses.Folded, PlayerStatuses.SittingOut, etc.
      /* etc. */
  </code></pre>
  
  <p>where each <code>CardGameState</code> is modified by some action:</p>
  
  <pre><code>public interface IAction
  {
      string Name { get; }
  
      CardGameState Apply(CardGameState state);
      bool IsLegal(CardGameState state);
  }
  </code></pre>
  
  <p>Now I'm feeling very strongly that this is defeating the purpose of object-oriented programming, because the data specifically related to the player (in this case, his chip stack, hand, and current status) is not encapsulated by the <code>Player</code> object. </p>
  
  <p>On the other hand, if a player were to raise the bet, I would be creating a <code>RaiseAction</code> that implements <code>IAction</code>, but the <code>IAction</code> interface only accepts the current game state, which I don't believe would be ideal if the chip stacks were stored within the <code>Player</code> class.</p>
  
  <p>Basically, my question is: can I have the best of both worlds such that I can have an exact representation of the game state while simultaneously keeping all data related specifically to an object within the game state inside its given object?</p>