Example #1
0
 /// <summary>
 /// Creates a new Hand from a Shoe of a specifies size
 /// </summary>
 /// <param name="size">The size of the new Hand</param>
 public Hand(CardCollection source, CardCollection discard = null)
 {
     if (discard == null) {
         discard = source;
     }
     this.cards = new List<Card>();
     this.source = source;
     this.discard = discard;
 }
Example #2
0
        public GameServant(bool testing = false)
        {
            log = new List<string>();
            l(string.Format("New Game ({0}:{1}:{2})", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), false);
            if (!testing) {
                l("In production mode...", false);
                this.ActiveHand = ActiveHandPotentials.None;
                l("Creating Source Deck", false);
                this._source = new CardCollection(1);
                l("Creating Discard Deck", false);
                this._discard = new CardCollection(1, false);

                this.ActiveHand = ActiveHandPotentials.Normal;

                l("Creating the player's hand", false);
                this._playerHand = new PlayerHand(_source, _discard);
                l("Creating the dealer's hand", false);
                this._dealerHand = new DealerHand(_source, _discard);
                l("Getting user name", false);
                (new GetUserName(this)).ShowDialog();
                l("User name received", false);
            } else {
                l("In testing mode...", false);
                this.ActiveHand = ActiveHandPotentials.None;
                var d = new Microsoft.Win32.OpenFileDialog();
                d.Filter = "CSV Files (.csv)|*.csv";
                d.ShowDialog();
                this._source = new PredeterministicCardCollection(d.FileName);
                this._discard = new CardCollection(Int32.MaxValue, false);

                this.ActiveHand = ActiveHandPotentials.Normal;
                this._playerHand = new PlayerHand(_source, _discard);
                this._dealerHand = new DealerHand(_source, _discard);
                (new GetUserName(this)).ShowDialog();
            }
            NotifyAll();
        }
Example #3
0
 /// <summary>
 /// Creates a new Blackjack Hand from the specified Shoe
 /// </summary>
 /// <param name="s">The parent Shoe this Hand si to be associated with</param>
 /// <param name="size">The size of this hand, defaulting to two. If this hand is split, set this to zero.</param>
 // TODO: Find a better way to handle splits when it comes to the constructor. Splitting functionality should be strictly limited to the PlayerHand.
 public BlackjackHand(CardCollection source, CardCollection discard)
     : base(source, discard)
 {
 }
Example #4
0
 /// <summary>
 /// Refill some other CardCollection with the cards from this CardCollection
 /// </summary>
 /// <param name="destination"></param>
 internal void Refill(CardCollection destination)
 {
     destination.cards.InsertRange(0, cards);
     cards.Clear();
 }
Example #5
0
 public PlayerHand(CardCollection source, CardCollection discard, uint cash = DEFAULT_CASH)
     : base(source, discard)
 {
     this.myCash = cash;
 }
Example #6
0
 /// <summary>
 /// Creates a Dealer Hand associated with the specified shoe
 /// </summary>
 /// <param name="shoe">the Shoe to associate with</param>
 public DealerHand(CardCollection source, CardCollection discard)
     : base(source, discard)
 {
 }