Esempio n. 1
0
        public SuitedThreeTexture(RiverBoard riverBoard)
        {
            if (riverBoard.SuitTexture != RiverSuitTextureEnum.ThreeSuited)
            {
                throw new InvalidOperationException();
            }

            switch (riverBoard.TurnBoard.SuitTexture)
            {
            case TurnBoardSuitTextureEnum.SuitedThree:
                var suitedThreeTurnBoard = new Turn.TurnBoardSuitTextures.SuitedThreeTexture(riverBoard.TurnBoard);
                Suit        = suitedThreeTurnBoard.SuitedSuit;
                SuitedRanks = new List <RankEnum>(suitedThreeTurnBoard.SuitedRanks);
                break;

            case TurnBoardSuitTextureEnum.SuitedTwoPairs:
                var suitedTwoPairsTurnBoard = new SuitedTwoPairsTexture(riverBoard.TurnBoard);
                Suit = riverBoard.River.Suit;
                if (suitedTwoPairsTurnBoard.SuitedSuit1 == Suit)
                {
                    SuitedRanks = new List <RankEnum>(suitedTwoPairsTurnBoard.Suit1Ranks);
                    SuitedRanks.Add(riverBoard.River.Rank);
                }
                else if (suitedTwoPairsTurnBoard.SuitedSuit2 == Suit)
                {
                    SuitedRanks = new List <RankEnum>(suitedTwoPairsTurnBoard.Suit2Ranks);
                    SuitedRanks.Add(riverBoard.River.Rank);
                }
                else
                {
                    throw new InvalidOperationException();
                }
                break;

            case TurnBoardSuitTextureEnum.SuitedTwo:
                var suitedTwoTurnBoard = new SuitedTwoTexture(riverBoard.TurnBoard);
                Suit        = suitedTwoTurnBoard.SuitedSuit;
                SuitedRanks = new List <RankEnum>(suitedTwoTurnBoard.SuitedRanks);
                SuitedRanks.Add(riverBoard.River.Rank);
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Esempio n. 2
0
        private Func <Card, Card, Tuple <SuitHandGradeEnum, int> > GetTurnGridGrader(TurnBoard turnBoard)
        {
            switch (turnBoard.SuitTexture)
            {
            case TurnBoardSuitTextureEnum.SuitedFour:
                return((c1, c2) =>
                {
                    var tuple = new Turn.TurnBoardSuitTextures.SuitedFourTexture(turnBoard).TestGridAgainstTurnBoard(c1, c2);
                    return new Tuple <SuitHandGradeEnum, int>(tuple.Item1.Grade(), tuple.Item2);
                });

            case TurnBoardSuitTextureEnum.SuitedThree:
                return((c1, c2) =>
                {
                    var tuple = new SuitedThreeTexture(turnBoard).TestGridAgainstTurnBoard(c1, c2);
                    return new Tuple <SuitHandGradeEnum, int>(tuple.Item1.Grade(), tuple.Item2);
                });

            case TurnBoardSuitTextureEnum.SuitedTwoPairs:
                return((c1, c2) =>
                {
                    var tuple = new SuitedTwoPairsTexture(turnBoard).TestGridAgainstTurnBoard(c1, c2);
                    return new Tuple <SuitHandGradeEnum, int>(tuple.Item1.Grade(), tuple.Item2);
                });

            case TurnBoardSuitTextureEnum.SuitedTwo:
                return((c1, c2) =>
                {
                    var tuple = new SuitedTwoTexture(turnBoard).TestGridAgainstTurnBoard(c1, c2);
                    return new Tuple <SuitHandGradeEnum, int>(tuple.Item1.Grade(), tuple.Item2);
                });

            case TurnBoardSuitTextureEnum.Offsuit:
                return((c1, c2) =>
                {
                    var tuple = new OffsuitTexture(turnBoard).TestGridAgainstTurnBoard(c1, c2);
                    return new Tuple <SuitHandGradeEnum, int>(tuple.Item1.Grade(), tuple.Item2);
                });

            default:
                throw new InvalidOperationException();
            }
        }