Exemplo n.º 1
0
        public GridHitNewRoundResultEnum HitRiver(RangeGrid grid)
        {
            RankHandGradeEnum turnGrade;
            int turnInvolved;

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

            case TurnBoardRankTextureEnum.HighPair:
                var highPairTuple = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard).TestGridAgainstBoard(grid);
                turnGrade    = highPairTuple.Item1.Grade();
                turnInvolved = highPairTuple.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);
        }
        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();
            }
        }
Exemplo n.º 3
0
        public HighTriRankTexture(RiverBoard board)
        {
            TurnBoard = board.TurnBoard;
            switch (TurnBoard.RankTexture)
            {
            case TurnBoardRankTextureEnum.HighTri:
                var highTriTexture = new Turn.TurnBoardRankTextures.HighTriRankTexture(TurnBoard);
                if (board.River.Rank == highTriTexture.SingleCard.Rank ||
                    board.River.Rank == highTriTexture.TriCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                TriCard1   = highTriTexture.TriCard1;
                TriCard2   = highTriTexture.TriCard2;
                TriCard3   = highTriTexture.TriCard3;
                MiddleCard = highTriTexture.SingleCard.Rank > board.River.Rank
                        ? highTriTexture.SingleCard
                        : board.River;
                LowCard = highTriTexture.SingleCard.Rank < board.River.Rank
                       ? highTriTexture.SingleCard
                       : board.River;
                break;

            case TurnBoardRankTextureEnum.HighPair:
                var highPairTexture = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard);
                if (board.River.Rank != highPairTexture.PairCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                TriCard1   = highPairTexture.PairCard1;
                TriCard2   = highPairTexture.PairCard2;
                TriCard3   = board.River;
                MiddleCard = highPairTexture.MiddleCard;
                LowCard    = highPairTexture.LowCard;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 4
0
        public SecondPairRankTexture(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();
                }
                HighCard    = board.River;
                PairedCard1 = highPairTexture.PairCard1;
                PairedCard2 = highPairTexture.PairCard2;
                ThirdCard   = highPairTexture.MiddleCard;
                LowCard     = highPairTexture.LowCard;
                break;

            case TurnBoardRankTextureEnum.MiddlePair:
                var middlePairTexture = new MiddlePairRankTexture(TurnBoard);
                if (board.River.Rank >= middlePairTexture.PairCard1.Rank)
                {
                    throw new InvalidOperationException();
                }
                if (board.River.Rank == middlePairTexture.LowCard.Rank)
                {
                    throw new InvalidOperationException();
                }
                HighCard    = middlePairTexture.HighCard;
                PairedCard1 = middlePairTexture.PairCard1;
                PairedCard2 = middlePairTexture.PairCard2;
                if (board.River.Rank > middlePairTexture.LowCard.Rank)
                {
                    ThirdCard = board.River;
                    LowCard   = middlePairTexture.LowCard;
                }
                else
                {
                    ThirdCard = middlePairTexture.LowCard;
                    LowCard   = board.River;
                }
                break;

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

            default:
                throw new InvalidOperationException();
            }
        }