Exemplo n.º 1
0
        /// <summary>
        ///   The name last action in sequence.
        /// </summary>
        /// <param name="actionSequence">
        ///   The action sequence.
        /// </param>
        /// <returns>
        ///   The name last action in sequence.
        /// </returns>
        /// <exception cref="NotSupportedException"></exception>
        public static string NameLastActionInSequence(ActionSequences actionSequence)
        {
            if (Folds.Contains(actionSequence))
            {
                return("Fold");
            }

            if (Calls.Contains(actionSequence))
            {
                return("Call");
            }

            if (Raises.Contains(actionSequence))
            {
                return("Raise");
            }

            if (Bets.Contains(actionSequence))
            {
                return("Bet");
            }

            if (actionSequence == ActionSequences.HeroX)
            {
                return("Check");
            }

            throw new NotSupportedException("Cannot name last action of " + actionSequence);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   The get last action in.
        /// </summary>
        /// <param name="actionSequence">
        ///   The action sequence.
        /// </param>
        /// <returns></returns>
        /// <exception cref="ArgumentException"></exception>
        public static ActionTypes GetLastActionIn(ActionSequences actionSequence)
        {
            if (Folds.Contains(actionSequence))
            {
                return(ActionTypes.F);
            }

            if (Calls.Contains(actionSequence))
            {
                return(ActionTypes.C);
            }

            if (Raises.Contains(actionSequence))
            {
                return(ActionTypes.R);
            }

            if (Checks.Contains(actionSequence))
            {
                return(ActionTypes.X);
            }

            if (Bets.Contains(actionSequence))
            {
                return(ActionTypes.B);
            }

            throw new ArgumentException(actionSequence + " has no last Action");
        }
Exemplo n.º 3
0
        private void UpdateScore(Bet bet, int scorePlus)
        {
            var betslikethis = FinihedBets.Where(x => x.Bet.Game.Id == bet.Game.Id).ToList();

            if (betslikethis.Count() > 1)
            {
                FinihedBets.Remove(betslikethis[1]);
                Score -= betslikethis[1].AchivedScore;
            }
            if (FinihedBets.Any(x => x.Bet.Id == bet.Id))
            {
                var finihed = FinihedBets.Where(x => x.Bet.Id == bet.Id).ToList();
                foreach (var finish in finihed)
                {
                    Score -= finish.AchivedScore;
                    FinihedBets.Remove(finish);
                }
            }
            Score += scorePlus;
            FinihedBets.Add(new FinishedBet(bet, scorePlus));

            if (Bets.Contains(bet))
            {
                Bets.Remove(bet);
            }
        }
Exemplo n.º 4
0
 public void RemoveBet(Bet bet)
 {
     if (FinihedBets.Any(x => x.Bet.Id == bet.Id))
     {
         throw new Exception("Can not remove completed bet");
     }
     if (Bets.Contains(bet))
     {
         Bets.Remove(bet);
     }
 }