Ejemplo n.º 1
0
 private static void DoubleDown(int wager, BlackjackGamePlayer player)
 {
     if (player.Account.Balance >= wager)
     {
         player.DoubleDown(wager);
     }
     else
     {
         player.DoubleDown(player.Account.Balance);
     }
 }
Ejemplo n.º 2
0
        public void PlayerActionRequest(BlackjackGamePlayer player, string request)
        {
            var currentAction = Players.FirstOrDefault(a => a.HasAction);

            if (PlayerActionIsExpired)
            {
                player.Stand();
            }
            else
            {
                switch (request.ToLower())
                {
                case "hit": player.Hit(); break;

                case "doubledown": player.DoubleDown(); break;

                case "stand": player.Stand(); break;
                }
            }

            var nextAction = Players.FirstOrDefault(a => a.HasAction);

            if (nextAction == null)
            {
                SettlePlayers();
                AwaitingPlayerActionSince = null;
            }
            else if (nextAction.Id != currentAction.Id)
            {
                AwaitingPlayerActionSince = DateTime.UtcNow;
            }
        }