コード例 #1
0
        void CreateWuTongDict()
        {
            wutongKeyDict.Clear();

            CardInfo[] cards = new CardInfo[5]
            {
                new CardInfo(), new CardInfo(),
                new CardInfo(), new CardInfo(),
                new CardInfo()
            };

            float score = CardsTypeEvaluation.GetWuTongBaseScore(14);

            AddWuTongKeyToList(null, score);

            for (int i = 1; i <= 13; i++)
            {
                cards[0].value = i;
                cards[1].value = i;
                cards[2].value = i;
                cards[3].value = i;
                cards[4].value = i;

                if (i == 1)
                {
                    score = CardsTypeEvaluation.GetWuTongBaseScore(14);
                }
                else
                {
                    score = CardsTypeEvaluation.GetWuTongBaseScore(i);
                }

                for (int s0 = 0; s0 < 4; s0++)
                {
                    cards[0].suit = s0;

                    for (int s1 = 0; s1 < 4; s1++)
                    {
                        cards[1].suit = s1;

                        for (int s2 = 0; s2 < 4; s2++)
                        {
                            cards[2].suit = s2;

                            for (int s3 = 0; s3 < 4; s3++)
                            {
                                cards[3].suit = s3;

                                for (int s4 = 0; s4 < 4; s4++)
                                {
                                    cards[4].suit = s4;

                                    AddWuTongKeyToList(cards, score);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        void CreateTongHuaDict()
        {
            tonghuaKeyDict.Clear();

            CardInfo[] cards = new CardInfo[5]
            {
                new CardInfo(), new CardInfo(),
                new CardInfo(), new CardInfo(),
                new CardInfo()
            };

            float score;

            for (int i = 1; i <= 13; i++)
            {
                cards[0].value = i;

                for (int j = 1; j <= 13; j++)
                {
                    cards[1].value = j;
                    for (int k = 1; k <= 13; k++)
                    {
                        cards[2].value = k;
                        for (int m = 1; m <= 13; m++)
                        {
                            cards[3].value = m;

                            for (int n = 1; n <= 13; n++)
                            {
                                if (i == j + 1 && j == k + 1 &&
                                    k == m + 1 && m == n + 1)
                                {
                                    continue;
                                }

                                score = CardsTypeEvaluation.GetTongHuaBaseScore(new float[] { i, j, k, m, n });

                                cards[4].value = n;

                                for (int y = 0; y < 4; y++)
                                {
                                    for (int x = 0; x < 5; x++)
                                    {
                                        cards[x].suit = y;
                                    }

                                    AddTongHuaKeyToList(cards, score);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        void CreateTieZhiDict()
        {
            tiezhiKeyDict.Clear();

            CardInfo[] cards = new CardInfo[4]
            {
                new CardInfo(), new CardInfo(),
                new CardInfo(), new CardInfo(),
            };

            float score = CardsTypeEvaluation.GetTieZhiBaseScore(14);

            AddTieZhiKeyToList(null, score);

            for (int i = 1; i <= 13; i++)
            {
                cards[0].value = i;
                cards[1].value = i;
                cards[2].value = i;
                cards[3].value = i;

                if (i == 1)
                {
                    score = CardsTypeEvaluation.GetTieZhiBaseScore(14);
                }
                else
                {
                    score = CardsTypeEvaluation.GetTieZhiBaseScore(i);
                }

                for (int s0 = 0; s0 < 4; s0++)
                {
                    cards[0].suit = s0;

                    for (int s1 = 0; s1 < 4; s1++)
                    {
                        cards[1].suit = s1;

                        for (int s2 = 0; s2 < 4; s2++)
                        {
                            cards[2].suit = s2;

                            for (int s3 = 0; s3 < 4; s3++)
                            {
                                cards[3].suit = s3;
                                AddTieZhiKeyToList(cards, score);
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        void CreateSanTiaoDict()
        {
            santiaoKeyDict.Clear();

            CardInfo[] cards = new CardInfo[3]
            {
                new CardInfo(), new CardInfo(),
                new CardInfo(),
            };

            float score = CardsTypeEvaluation.GetSanTiaoBaseScore(14);

            AddSanTiaoKeyToList(null, score);

            for (int i = 1; i <= 13; i++)
            {
                cards[0].value = i;
                cards[1].value = i;
                cards[2].value = i;

                if (i == 1)
                {
                    score = CardsTypeEvaluation.GetSanTiaoBaseScore(14);
                }
                else
                {
                    score = CardsTypeEvaluation.GetSanTiaoBaseScore(i);
                }

                for (int s0 = 0; s0 < 4; s0++)
                {
                    cards[0].suit = s0;

                    for (int s1 = 0; s1 < 4; s1++)
                    {
                        cards[1].suit = s1;

                        for (int s2 = 0; s2 < 4; s2++)
                        {
                            cards[2].suit = s2;
                            AddSanTiaoKeyToList(cards, score);
                        }
                    }
                }
            }
        }
コード例 #5
0
        void CreateDuiZiDict()
        {
            duiziKeyDict.Clear();

            CardInfo[] cards = new CardInfo[2]
            {
                new CardInfo(), new CardInfo(),
            };

            float score = CardsTypeEvaluation.GetDuiziBaseScore(14);

            AddDuiZiKeyToList(null, score);

            for (int i = 1; i <= 13; i++)
            {
                cards[0].value = i;
                cards[1].value = i;

                if (i == 1)
                {
                    score = CardsTypeEvaluation.GetDuiziBaseScore(14);
                }
                else
                {
                    score = CardsTypeEvaluation.GetDuiziBaseScore(i);
                }

                for (int s0 = 0; s0 < 4; s0++)
                {
                    cards[0].suit = s0;

                    for (int s1 = 0; s1 < 4; s1++)
                    {
                        cards[1].suit = s1;
                        AddDuiZiKeyToList(cards, score);
                    }
                }
            }
        }
コード例 #6
0
        void CreateTwoDuiDict()
        {
            twoduiKeyDict.Clear();

            CardInfo[] cards = new CardInfo[4]
            {
                new CardInfo(), new CardInfo(),
                new CardInfo(), new CardInfo(),
            };

            float score;
            float a, b;

            for (int i = 1; i <= 13; i++)
            {
                cards[0].value = i;
                cards[1].value = i;


                for (int s0 = 0; s0 < 4; s0++)
                {
                    cards[0].suit = s0;

                    for (int s1 = 0; s1 < 4; s1++)
                    {
                        cards[1].suit = s1;

                        for (int j = 1; j <= 13; j++)
                        {
                            cards[2].value = j;
                            cards[3].value = j;

                            if (i == 1)
                            {
                                a = 14;
                            }
                            else
                            {
                                a = i;
                            }

                            if (j == 1)
                            {
                                b = 14;
                            }
                            else
                            {
                                b = j;
                            }

                            score = CardsTypeEvaluation.GetTwoDuiBaseScore(a, b);

                            for (int m0 = 0; m0 < 4; m0++)
                            {
                                cards[2].suit = m0;

                                for (int m1 = 0; m1 < 4; m1++)
                                {
                                    cards[3].suit = m1;

                                    AddTwoDuiKeyToList(cards, score);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
        void AddHuluKeyToList(CardInfo[] cards, float score)
        {
            if (isCheckSuitCount)
            {
                int[]        value      = new int[14];
                List <int>[] suitCounts = new List <int>[4]
                {
                    new List <int>(value), new List <int>(value), new List <int>(value), new List <int>(value)
                };

                for (int i = 0; i < cards.Length; i++)
                {
                    suitCounts[cards[i].suit][cards[i].value]++;
                    if (suitCounts[cards[i].suit][cards[i].value] > limitSameSuitCount)
                    {
                        return;
                    }
                }
            }


            if (cards[0].value == cards[1].value &&
                cards[0].value == cards[2].value &&
                cards[0].value == cards[3].value &&
                cards[0].value == cards[4].value)
            {
                return;
            }

            CardKey cardkey = new CardKey();

            for (int i = 0; i < cards.Length; i++)
            {
                cardkey = AppendCardToCardKey(cardkey, cards[i].value, cards[i].suit);
            }

            AddToDict(huluKeyDict, cardkey, 0, score);

            //
            int   tmp1;
            float score2 = score;
            float tmpScore;

            if (cards[0].value < cards[3].value)
            {
                score2 = CardsTypeEvaluation.GetHuLuBaseScore(cards[3].value, cards[0].value);
            }

            for (int i = 0; i < 4; i++)
            {
                tmp1           = cards[i].value;
                cards[i].value = -1;

                cardkey = new CardKey();
                for (int j = 0; j < cards.Length; j++)
                {
                    if (cards[j].value == -1)
                    {
                        continue;
                    }

                    cardkey = AppendCardToCardKey(cardkey, cards[j].value, cards[j].suit);
                }

                if (i > 2)
                {
                    tmpScore = score2;
                }
                else
                {
                    tmpScore = score;
                }

                AddToDict(huluKeyDict, cardkey, 1, tmpScore);
                cards[i].value = tmp1;
            }
        }
コード例 #8
0
        void CreateShunziDict()
        {
            shunziKeyDict.Clear();

            CardInfo[] cards = new CardInfo[5]
            {
                new CardInfo(), new CardInfo(),
                new CardInfo(), new CardInfo(),
                new CardInfo()
            };

            float score = CardsTypeEvaluation.GetShunZiBaseScore(10);

            AddShunziKeyToList(null, 0, score);

            for (int i = 1; i <= 10; i++)
            {
                score = CardsTypeEvaluation.GetShunZiBaseScore(i);

                for (int s0 = -1; s0 < 4; s0++)
                {
                    if (s0 != -1)
                    {
                        cards[0].value = i;
                        cards[0].suit  = s0;
                        AddShunziKeyToList(cards, 1, score);
                    }
                    else
                    {
                        cards[0].value = -1;
                    }

                    for (int s1 = -1; s1 < 4; s1++)
                    {
                        if (s1 != -1)
                        {
                            cards[1].value = i + 1;
                            cards[1].suit  = s1;
                            AddShunziKeyToList(cards, 2, score);
                        }
                        else
                        {
                            cards[1].value = -1;
                        }

                        for (int s2 = -1; s2 < 4; s2++)
                        {
                            if (s2 != -1)
                            {
                                cards[2].value = i + 2;
                                cards[2].suit  = s2;
                                AddShunziKeyToList(cards, 3, score);
                            }
                            else
                            {
                                cards[2].value = -1;
                            }

                            for (int s3 = -1; s3 < 4; s3++)
                            {
                                if (s3 != -1)
                                {
                                    cards[3].value = i + 3;
                                    cards[3].suit  = s3;
                                    AddShunziKeyToList(cards, 4, score);
                                }
                                else
                                {
                                    cards[3].value = -1;
                                }


                                for (int s4 = 0; s4 < 4; s4++)
                                {
                                    cards[4].suit = s4;
                                    if (i + 4 == 14)
                                    {
                                        cards[4].value = 1;
                                    }
                                    else
                                    {
                                        cards[4].value = i + 4;
                                    }

                                    AddShunziKeyToList(cards, 5, score);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #9
0
 public Comparer(CardsTypeEvaluation cardsTypeEval)
 {
     this.cardsTypeEval = cardsTypeEval;
 }