private static void DoubleDown(int wager, BlackjackGamePlayer player) { if (player.Account.Balance >= wager) { player.DoubleDown(wager); } else { player.DoubleDown(player.Account.Balance); } }
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; } }