Пример #1
0
        public GridHitNewRoundResultEnum HitRiver(RangeGrid grid)
        {
            RankHandGradeEnum turnGrade;
            int turnInvolved;

            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.HighPair:
                var highPairTuple = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard).TestGridAgainstBoard(grid);
                turnGrade    = highPairTuple.Item1.Grade();
                turnInvolved = highPairTuple.Item2;
                break;

            case TurnBoardRankTextureEnum.Singles:
                var singlesTuple = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard).TestGridAgainstBoard(grid);
                turnGrade    = singlesTuple.Item1.Grade();
                turnInvolved = singlesTuple.Item2;
                break;

            default:
                throw new InvalidOperationException($"Impossible to have {TurnBoard.RankTexture}");
            }
            var riverTuple        = TestGridAgainstBoard(grid);
            var riverOutcomeGrade = riverTuple.Item1.Grade();
            var riverInvolved     = riverTuple.Item2;

            if (riverOutcomeGrade > turnGrade)
            {
                return((riverInvolved > turnInvolved) ? GridHitNewRoundResultEnum.Promoted : GridHitNewRoundResultEnum.Enhanced);
            }
            return(GridHitNewRoundResultEnum.None);
        }
Пример #2
0
        public HighPairRankTexture(RiverBoard board)
        {
            TurnBoard = board.TurnBoard;
            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.HighPair:
                var highPairTexture = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard);
                if (board.River.Rank >= highPairTexture.PairCard1.Rank)
                {
                    throw new InvalidOperationException();
                }

                if (board.River.Rank == highPairTexture.MiddleCard.Rank ||
                    board.River.Rank == highPairTexture.LowCard.Rank)
                {
                    throw new InvalidOperationException();
                }

                PairedCard1 = highPairTexture.PairCard1;
                PairedCard2 = highPairTexture.PairCard2;

                var singles = new List <Card>()
                {
                    highPairTexture.MiddleCard, highPairTexture.LowCard, board.River
                };
                singles.Sort();
                LowCard    = singles[0];
                ThirdCard  = singles[1];
                SecondCard = singles[2];
                break;

            case TurnBoardRankTextureEnum.Singles:
                var singlesPairTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard);
                if (board.River.Rank != singlesPairTexture.HighCard.Rank)
                {
                    throw new InvalidOperationException();
                }

                PairedCard1 = singlesPairTexture.HighCard;
                PairedCard2 = board.River;
                SecondCard  = singlesPairTexture.SecondCard;
                ThirdCard   = singlesPairTexture.ThirdCard;
                LowCard     = singlesPairTexture.LowCard;
                break;

            default:
                throw new InvalidOperationException();
            }
        }