Exemple #1
0
    public void Test16()
    {
        // _getTipsScore方法检测
        DizhuPromptAI_Freeout_V1 dai = new DizhuPromptAI_Freeout_V1();
        // [(['3', '4', '5', '6', '7'], 15050000),
        // (['3', '4', '5', '6', '7', '8'], 15060000),
        // (['5'], 30000000),
        // (['7'], 50000000),
        // (['8'], 60000000),
        // (['8', '8'], 61000000),
        // (['10', '10'], 81000000),
        // (['10', 'J', 'Q', 'K', 'A'], 85050000),
        // (['Q'], 100000000),
        // (['5', '2', '2', '2'], 132030000),
        // (['7', '2', '2', '2'], 132050000),
        // (['8', '2', '2', '2'], 132060000),
        // (['Q', '2', '2', '2'], 132100000),
        // (['8', '8', '2', '2', '2'], 133060600),
        // (['10', '10', '2', '2', '2'], 133080800)]
        // List<List<string>> cards = new List<List<string>>{
        //     new List<string>{"8", "8"},
        //     new List<string>{"10", "10"},
        //     new List<string>{"10", "J", "Q", "K", "A"},
        //     new List<string>{"Q"},
        //     new List<string>{"5", "2", "2", "2"},
        //     new List<string>{"7", "2", "2", "2"},
        //     new List<string>{"8", "2", "2", "2"},
        //     new List<string>{"Q", "2", "2", "2"},
        //     new List<string>{"8", "8", "2", "2", "2"},
        //     new List<string>{"10", "10", "2", "2", "2"},
        //     new List<string>{"3", "4", "5", "6", "7"},
        //     new List<string>{"3", "4", "5", "6", "7", "8"},
        //     new List<string>{"5"},
        //     new List<string>{"7"},
        //     new List<string>{"8"}
        // };
        List <List <string> > cards = new List <List <string> > {
            new List <string> {
                "3", "4", "5", "6", "6", "6", "7", "7", "7", "8", "8", "8"
            },
            new List <string> {
                "3", "4", "6", "6", "6", "7", "7", "7", "8", "8", "8", "K"
            }
        };
        // List<int> scores = new List<int>();
        // for(int i = 0; i < cards.Count; ++i){
        //     scores.Add(dai._getTipsScore(cards[i]));
        // }
        // int count = scores.Count;
        int score1 = dai._getTipsScore(cards[0]);
        int score2 = dai._getTipsScore(cards[1]);

        cards.Sort(delegate(List <string> left, List <string> right)
        {
            return(dai._getTipsScore(left) - dai._getTipsScore(right));
        });
        int i;
    }
Exemple #2
0
 public static List <List <CardInfo> > GetRecommendedCards(List <CardInfo> myCards, bool forward = true, List <CardInfo> topCards = null)
 {
     // Debug.LogError("myCards.Count=" + myCards.Count);
     // 主动出牌提示
     if (forward)
     {
         // return CardUtil.AIFindActiveCards(myCards);
         Dictionary <string, int> intMap = new Dictionary <string, int> {
             { "3", 2 },
             { "4", 3 },
             { "5", 4 },
             { "6", 5 },
             { "7", 6 },
             { "8", 7 },
             { "9", 8 },
             { "10", 9 },
             { "J", 10 },
             { "Q", 11 },
             { "K", 12 },
             { "A", 0 },
             { "2", 1 },
             { "joker", 52 },
             { "JOKER", 53 }
         };
         List <string> rC = new List <string>();
         foreach (CardInfo ci in myCards)
         {
             rC.Add(ci.serverNum.ToString());
         }
         DizhuPromptAI_Freeout_V1 AI = new DizhuPromptAI_Freeout_V1();
         List <int> ic = new List <int>();
         foreach (var i in rC)
         {
             ic.Add(intMap[i]);
         }
         List <List <int> > ret = AI.AI_promptCards(ic);
         return(null);
     }
     else
     {
         Debug.Assert(null != topCards);
         CardType cardType = CardUtil.CheckCardType(topCards, out int lv);
         return(CardUtil.AIFindWinCards(myCards, topCards, cardType));
     }
 }
Exemple #3
0
    public void Test10()
    {
        DizhuPromptAI_Freeout_V1 AI     = new DizhuPromptAI_Freeout_V1();
        Dictionary <string, int> intMap = new Dictionary <string, int> {
            { "3", 2 },
            { "4", 3 },
            { "5", 4 },
            { "6", 5 },
            { "7", 6 },
            { "8", 7 },
            { "9", 8 },
            { "10", 9 },
            { "J", 10 },
            { "Q", 11 },
            { "K", 12 },
            { "A", 0 },
            { "2", 1 },
            { "joker", 52 },
            { "JOKER", 53 }
        };
        // List<string> rC = new List<string>{"3", "4", "4", "5", "5", "6", "6", "7", "7", "8", "8", "8", "9", "9", "10", "10", "A", "J", "K", "Q"};
        // List<string> rC = new List<string>{"3", "4", "4", "5", "5", "6", "6", "7", "7"};
        // List<string> rC = AI._transToReadableCards(new List<int>{5, 18, 31, 44, 29, 26, 14, 41, 27, 0, 11, 32, 50, 47, 16, 53, 38});
        // List<string> rC = AI._transToReadableCards(new List<int>{9,22,35,48,7,1,40,18,2,39,13,8,16,41,45,47,25,29,52,26});
        // List<string> rC = AI._transToReadableCards(new List<int>{35,29,42,13,40,10,23,12,22,30,25,3,34,43,52,49,33,48,36,32});
        // List<string> rC = AI._transToReadableCards(new List<int>{15,18,32,34,7,29,3,23,22,26,21,38,31,0,37,51,50,9,45,25});
        List <string> rC = AI._transToReadableCards(new List <int> {
            6, 19, 32, 45, 36, 16, 15, 42, 18, 50, 4, 41, 28, 3, 49, 51, 48, 2, 27, 0
        });
        // List<string> rC = new List<string>{"3", "4", "5", "5", "6", "7", "7", "8", "8", "10", "10", "10", "J", "Q", "Q", "K", "A", "2", "2", "2"};
        List <int> ic = new List <int>();

        foreach (var i in rC)
        {
            ic.Add(intMap[i]);
        }
        // List<List<int>> x = AI.AI_promptCards(new List<int>{50, 37, 24, 11});
        DateTime           time1 = DateTime.Now;
        List <List <int> > ret   = AI.AI_promptCards(ic);
        DateTime           time2 = DateTime.Now;

        Debug.Log("cost:" + (time2 - time1).TotalMilliseconds);
        Debug.Log("over");
        // new DizhuDeckAnalyzer().exhaustionDivision_prompt(rC);
    }
Exemple #4
0
 public static List <List <string> > GetRecommendedCards(List <int> myCards, bool forward = true, List <CardInfo> topCards = null)
 {
     // 主动出牌提示
     if (forward)
     {
         Dictionary <string, int> intMap = new Dictionary <string, int> {
             { "3", 2 },
             { "4", 3 },
             { "5", 4 },
             { "6", 5 },
             { "7", 6 },
             { "8", 7 },
             { "9", 8 },
             { "10", 9 },
             { "J", 10 },
             { "Q", 11 },
             { "K", 12 },
             { "A", 0 },
             { "2", 1 },
             { "joker", 52 },
             { "JOKER", 53 }
         };
         DizhuPromptAI_Freeout_V1 AI = new DizhuPromptAI_Freeout_V1();
         List <string>            rC = AI._transToReadableCards(myCards);
         List <int> ic = new List <int>();
         foreach (var i in rC)
         {
             ic.Add(intMap[i]);
         }
         List <List <int> >    ret    = AI.AI_promptCards(ic);
         List <List <string> > strRet = new List <List <string> >();
         foreach (var r in ret)
         {
             List <string> rdeckCards = AI._transToReadableCards(r);
             strRet.Add(rdeckCards);
         }
         return(strRet);
     }
     else
     {
         Debug.Assert(null != topCards);
         CardType cardType = CardUtil.CheckCardType(topCards, out int lv);
         return(null);
     }
 }
Exemple #5
0
    // 测试 _updateShunzi
    private void Test23()
    {
        List <string> tips = new List <string> {
            "3", "3"
        };
        List <List <string> > shunzi = new List <List <string> > {
            new List <string> {
                "8", "9", "10", "J", "Q"
            },
            new List <string> {
                "10", "J", "Q", "K", "A"
            }
        };
        List <string> cards = new List <string> {
            "7", "7", "7", "7", "3", "10", "8", "3", "2", "A", "9", "Q", "J", "10", "Q", "J", "K"
        };
        Dictionary <string, int> groups = BaseDeckPattern.groupby(cards);

        List <List <List <string> > > ret = new DizhuPromptAI_Freeout_V1()._updateShunzi(tips, shunzi, groups);
    }