예제 #1
0
        public GridHitNewRoundResultEnum HitRiver(RangeGrid grid)
        {
            RankHandGradeEnum turnGrade;
            int turnInvolved;

            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.LowPair:
                var lowPairTuple = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard).TestGridAgainstBoard(grid);
                turnGrade    = lowPairTuple.Item1.Grade();
                turnInvolved = lowPairTuple.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 ThirdPairRankTexture(RiverBoard board)
        {
            TurnBoard = board.TurnBoard;
            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.MiddlePair:
                var middlePairTexture = new MiddlePairRankTexture(TurnBoard);
                if (board.River.Rank <= middlePairTexture.PairCard1.Rank ||
                    board.River.Rank == middlePairTexture.HighCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                if (board.River.Rank > middlePairTexture.HighCard.Rank)
                {
                    HighCard   = board.River;
                    SecondCard = middlePairTexture.HighCard;
                }
                else
                {
                    HighCard   = middlePairTexture.HighCard;
                    SecondCard = board.River;
                }
                PairedCard1 = middlePairTexture.PairCard1;
                PairedCard2 = middlePairTexture.PairCard2;
                LowCard     = middlePairTexture.LowCard;
                break;

            case TurnBoardRankTextureEnum.LowPair:
                var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard);
                if (board.River.Rank >= lowPairTexture.PairCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighCard    = lowPairTexture.HighCard;
                SecondCard  = lowPairTexture.MiddleCard;
                PairedCard1 = lowPairTexture.PairCard1;
                PairedCard2 = lowPairTexture.PairCard2;
                LowCard     = board.River;
                break;

            case TurnBoardRankTextureEnum.Singles:
                var singlesTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard);
                if (board.River.Rank != singlesTexture.ThirdCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighCard    = singlesTexture.HighCard;
                SecondCard  = singlesTexture.SecondCard;
                PairedCard1 = singlesTexture.ThirdCard;
                PairedCard2 = board.River;
                LowCard     = singlesTexture.LowCard;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
        public HighLowTwoPairsRankTexture(RiverBoard board)
        {
            TurnBoard = board.TurnBoard;
            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.HighPair:
                var highPairTexture = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard);
                if (board.River.Rank != highPairTexture.LowCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighPairCard1 = highPairTexture.PairCard1;
                HighPairCard2 = highPairTexture.PairCard2;
                MiddleCard    = highPairTexture.MiddleCard;
                LowPairCard1  = highPairTexture.LowCard;
                LowPairCard2  = board.River;
                break;

            case TurnBoardRankTextureEnum.LowPair:
                var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard);
                if (board.River.Rank != lowPairTexture.HighCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighPairCard1 = lowPairTexture.HighCard;
                HighPairCard2 = board.River;
                MiddleCard    = lowPairTexture.MiddleCard;
                LowPairCard1  = lowPairTexture.PairCard1;
                LowPairCard2  = lowPairTexture.PairCard2;
                break;

            case TurnBoardRankTextureEnum.TwoPairs:
                var twoPairsTexture = new TwoPairsRankTexture(TurnBoard);
                if (board.River.Rank >= twoPairsTexture.HighPairCard1.Rank ||
                    board.River.Rank <= twoPairsTexture.LowPairCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighPairCard1 = twoPairsTexture.HighPairCard1;
                HighPairCard2 = twoPairsTexture.HighPairCard2;
                MiddleCard    = board.River;
                LowPairCard1  = twoPairsTexture.LowPairCard1;
                LowPairCard2  = twoPairsTexture.LowPairCard2;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
예제 #4
0
        public LowPairRankTexture(RiverBoard board)
        {
            TurnBoard = board.TurnBoard;
            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.LowPair:
                var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard);
                if (board.River.Rank <= lowPairTexture.PairCard1.Rank ||
                    board.River.Rank == lowPairTexture.HighCard.Rank ||
                    board.River.Rank == lowPairTexture.MiddleCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                var cards = new List <Card>()
                {
                    lowPairTexture.HighCard, lowPairTexture.MiddleCard, board.River
                };
                cards.Sort();
                HighCard    = cards[2];
                SecondCard  = cards[1];
                ThirdCard   = cards[0];
                PairedCard1 = lowPairTexture.PairCard1;
                PairedCard2 = lowPairTexture.PairCard2;
                break;

            case TurnBoardRankTextureEnum.Singles:
                var singlesTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard);
                if (board.River.Rank != singlesTexture.LowCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighCard    = singlesTexture.HighCard;
                SecondCard  = singlesTexture.SecondCard;
                ThirdCard   = singlesTexture.ThirdCard;
                PairedCard1 = singlesTexture.LowCard;
                PairedCard2 = board.River;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
예제 #5
0
        public LowTriRankTexture(RiverBoard board)
        {
            TurnBoard = board.TurnBoard;
            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.LowTri:
                var lowTriTexture = new Turn.TurnBoardRankTextures.LowTriRankTexture(TurnBoard);
                if (board.River.Rank == lowTriTexture.SingleCard.Rank ||
                    board.River.Rank < lowTriTexture.TriCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighCard = board.River.Rank > lowTriTexture.SingleCard.Rank
                        ? board.River
                        : lowTriTexture.SingleCard;
                MiddleCard = board.River.Rank < lowTriTexture.SingleCard.Rank
                        ? board.River
                        : lowTriTexture.SingleCard;
                TriCard1 = lowTriTexture.TriCard1;
                TriCard2 = lowTriTexture.TriCard2;
                TriCard3 = lowTriTexture.TriCard3;
                break;

            case TurnBoardRankTextureEnum.LowPair:
                var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard);
                if (board.River.Rank != lowPairTexture.PairCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighCard   = lowPairTexture.HighCard;
                MiddleCard = lowPairTexture.MiddleCard;
                TriCard1   = lowPairTexture.PairCard1;
                TriCard2   = lowPairTexture.PairCard2;
                TriCard3   = board.River;
                break;

            default:
                throw new InvalidOperationException();
            }
        }