Example #1
0
        public string GameResult()
        {
            PokerVote highest = GetHighestVote();
            PokerVote lowest  = GetLowestVote();

            if (lowest == null)
            {
                return("Nobody voted, please restart game.");
            }
            if (lowest.VoteCard == PokerCard.cCoffee)
            {
                return("Somebody needs some coffee. Please restart the game.");
            }
            if ((highest.VoteCard - lowest.VoteCard) <= 1)
            {
                return("<b><font size=\"+3\">" + ((int)highest.VoteCard).ToString() + "</font></b> story points");
            }
            else
            {
                StringBuilder SB = new StringBuilder();
                foreach (PokerVote vote in Votes)
                {
                    if (vote.VoteCard.Equals(highest.VoteCard) | (vote.VoteCard.Equals(lowest.VoteCard)))
                    {
                        SB.Append(vote.VoteParticipant.Name + ", ");
                    }
                }
                if (SB.Length > 0)
                {
                    return(SB.ToString().Substring(0, SB.Length - 1) + " please explain your estimates.");
                }
            }
            return("Indeterminate result");
        }
Example #2
0
 public void SendVote(PokerVote vote)
 {
     if (!HasVoted(vote.VoteParticipant))
     {
         Votes.Add(vote);
         OnGameChanged?.Invoke();
     }
     else
     {
         throw new SCRUMPokerException("Participant already voted");
     }
 }
Example #3
0
        private PokerVote GetLowestVote()
        {
            if (Votes.Count == 0)
            {
                return(null);
            }
            PokerVote result = Votes[0];

            foreach (PokerVote vote in Votes)
            {
                if (vote.VoteCard < result.VoteCard)
                {
                    result = vote;
                }
            }
            return(result);
        }