コード例 #1
0
        private string CheckForPair()
        {
            var firstHandPairRankValue  = evaluator.PairValues(firstPlayerCards);
            var secondHandPairRankValue = evaluator.PairValues(secondPlayerCards);

            if (firstHandPairRankValue[0] == Constants.NO_VALUE && secondHandPairRankValue[0] == Constants.NO_VALUE)
            {
                return(Constants.NO_RESULT);
            }

            for (var idx = 0; idx < firstHandPairRankValue.Length; idx++)
            {
                if (firstHandPairRankValue[idx] > secondHandPairRankValue[idx])
                {
                    return(string.Format("{0} wins - pair", firstPlayerName));
                }
                if (firstHandPairRankValue[idx] < secondHandPairRankValue[idx])
                {
                    return(string.Format("{0} wins - pair", secondPlayerName));
                }
            }
            return("Tie");
        }