Exemplo 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();
            }
        }
Exemplo 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 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();
            }
        }
Exemplo n.º 3
0
        private void SetupSuitTexture()
        {
            switch (TurnBoard.SuitTexture)
            {
            case TurnBoardSuitTextureEnum.SuitedFour:
                var suitedFour = new SuitedFourTexture(TurnBoard);
                if (River.Suit == suitedFour.SuitedSuit)
                {
                    SuitTexture = RiverSuitTextureEnum.FiveSuited;
                }
                else
                {
                    SuitTexture = RiverSuitTextureEnum.FourSuited;
                }
                break;

            case TurnBoardSuitTextureEnum.SuitedThree:
                var suitedThree = new SuitedThreeTexture(TurnBoard);
                if (River.Suit == suitedThree.SuitedSuit)
                {
                    SuitTexture = RiverSuitTextureEnum.FourSuited;
                }
                else
                {
                    SuitTexture = RiverSuitTextureEnum.ThreeSuited;
                }
                break;

            case TurnBoardSuitTextureEnum.SuitedTwoPairs:
                var suitedTwoPairs = new SuitedTwoPairsTexture(TurnBoard);
                if (River.Suit == suitedTwoPairs.SuitedSuit1)
                {
                    SuitTexture = RiverSuitTextureEnum.ThreeSuited;
                }
                else if (River.Suit == suitedTwoPairs.SuitedSuit2)
                {
                    SuitTexture = RiverSuitTextureEnum.ThreeSuited;
                }
                else
                {
                    SuitTexture = RiverSuitTextureEnum.Offsuit;
                }
                break;

            case TurnBoardSuitTextureEnum.SuitedTwo:
                var suitedTwo = new SuitedTwoTexture(TurnBoard);
                if (River.Suit == suitedTwo.SuitedSuit)
                {
                    SuitTexture = RiverSuitTextureEnum.ThreeSuited;
                }
                else
                {
                    SuitTexture = RiverSuitTextureEnum.Offsuit;
                }
                break;

            case TurnBoardSuitTextureEnum.Offsuit:
                SuitTexture = RiverSuitTextureEnum.Offsuit;
                break;

            default:
                throw new InvalidOperationException();
            }
        }