Exemplo n.º 1
0
        public GridHitNewRoundResultEnum HitTurn(RangeGrid grid)
        {
            RankHandGradeEnum flopGrade;
            int flopInvolved;

            switch (FlopBoard.RankTexture)
            {
            case FlopBoardRankTextureEnum.LowPair:
                var lowPairTuple = new Flop.FlopBoardRankTextures.LowPairRankTexture(FlopBoard).TestGridAgainstBoard(grid);
                flopGrade    = lowPairTuple.Item1.Grade();
                flopInvolved = lowPairTuple.Item2;
                break;

            case FlopBoardRankTextureEnum.HighPair:
                var highPairTuple = new Flop.FlopBoardRankTextures.HighPairRankTexture(FlopBoard).TestGridAgainstBoard(grid);
                flopGrade    = highPairTuple.Item1.Grade();
                flopInvolved = highPairTuple.Item2;
                break;

            default:
                throw new InvalidOperationException($"Impossible to have {FlopBoard.RankTexture}");
            }
            var turnTuple        = TestGridAgainstBoard(grid);
            var turnOutcomeGrade = turnTuple.Item1.Grade();
            var turnInvolved     = turnTuple.Item2;

            if (turnOutcomeGrade > flopGrade)
            {
                return((turnInvolved > flopInvolved) ? GridHitNewRoundResultEnum.Promoted : GridHitNewRoundResultEnum.Enhanced);
            }
            return(GridHitNewRoundResultEnum.None);
        }
Exemplo n.º 2
0
 public TwoPairsRankTexture(TurnBoard turnBoard)
 {
     FlopBoard = turnBoard.FlopBoard;
     if (FlopBoard.RankTexture == FlopBoardRankTextureEnum.HighPair)
     {
         var highPairBoard = new Flop.FlopBoardRankTextures.HighPairRankTexture(FlopBoard);
         if (highPairBoard.SingleCard.Rank != turnBoard.TurnCard.Rank)
         {
             throw new InvalidOperationException();
         }
         HighPairCard1 = highPairBoard.PairCard1;
         HighPairCard2 = highPairBoard.PairCard2;
         LowPairCard1  = highPairBoard.SingleCard;
         LowPairCard2  = turnBoard.TurnCard;
     }
     else if (FlopBoard.RankTexture == FlopBoardRankTextureEnum.LowPair)
     {
         var lowPairBoard = new Flop.FlopBoardRankTextures.LowPairRankTexture(FlopBoard);
         if (lowPairBoard.SingleCard.Rank != turnBoard.TurnCard.Rank)
         {
             throw new InvalidOperationException();
         }
         HighPairCard1 = lowPairBoard.SingleCard;
         HighPairCard2 = turnBoard.TurnCard;
         LowPairCard1  = lowPairBoard.PairCard1;
         LowPairCard2  = lowPairBoard.PairCard2;
     }
     else
     {
         throw new InvalidOperationException();
     }
 }