Exemplo n.º 1
0
        static void Main(string[] args)
        {
            const int drawTestNumber = 100;
            ICozyGodEngine engine = new CozyGodEngine();
            engine.Init();

            Card[] pentaDrawTest;
            IRaffle iRaffle = engine.GetRaffle();
            int[] cardRet = new int[10];
            for (int n = 0; n < drawTestNumber; n++)
            {
                pentaDrawTest = iRaffle.PentaDraw();

                foreach (var c in pentaDrawTest)
                {
                    if(c != null)
                    {
                        System.Console.WriteLine("card name : {0}, card level : {1}", c.Name, c.Level);
                        cardRet[c.Level]++;
                    }
                    else
                    {
                        System.Console.WriteLine("你抽到一张并不存在的卡牌");
                        return;
                    }
                }
                System.Console.WriteLine("---------------------------------------------");
            }

            for(int i = 0; i < cardRet.Length; i++)
            {
                System.Console.WriteLine("level:{0} count: {1} probability: {2};", i,cardRet[i],cardRet[i]/(5.0 * drawTestNumber));
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ICozyGodEngine engine = new CozyGodEngine();
            engine.Init();

            ICraft i = engine.GetCraft();
            Card a = null;
            Card b = null;
            ICardLibrary lib = engine.GetCardLibrary();


            while(true)
            {
                string input = System.Console.ReadLine();
                string[] craftCard = input.Split(',');
                if(craftCard.Length < 2)
                {
                    System.Console.WriteLine("Input Error, \"name,name\"");
                    continue;
                }
                a = lib.FindCardByName(craftCard[0]);
                b = lib.FindCardByName(craftCard[1]);
                if (a != null && b != null)
                {
                    System.Console.Write("card : {0}, level : {1} + card : {2}, card level : {3} = "
                        , a.Name, a.Level, b.Name, b.Level);
                }
                else
                {
                    System.Console.Write("Some card has no fond.");
                    continue;
                }
                Card cardRet = null;
                if (i.TryCraft(a, b))
                {
                    cardRet = i.Craft(a, b);
                }
                else
                {
                    System.Console.WriteLine("null");
                    continue;
                }
                System.Console.WriteLine("card : {0}, level : {1}", cardRet.Name, cardRet.Level);
            }
            
        }