예제 #1
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));
     }
 }
예제 #2
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);
    }
예제 #3
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);
     }
 }