Esempio n. 1
0
        static void Main(string[] args)
        {
            Forest D = new Forest(1, 2000, GenerateData, 4);

            Console.WriteLine(D);
            int Correct = 0;
            for(int c=0;c<500000; ++c)
            {
                AttributeValue[] E = GenerateEntry();
                AttributeValue Decision = D.MakeDecision(E);
                E[4] = Decision;
                /*
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("DOWN IS {0}", DataToCardAlt(E[0], E[1]));
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("I HAVE");
                Console.ForegroundColor = ConsoleColor.Green;
                for (int i = 0; i < 3; ++i) Console.WriteLine(DataToCardAlt(E[i * 2 + 2], E[i * 2 + 3]));
                Console.ForegroundColor = ConsoleColor.Magenta;
                int p = Convert.ToInt32(E[8].ToString());
                Console.WriteLine("I PLAY {0}", (p > -1 ? DataToCardAlt(E[p * 2 + 2], E[p * 2 + 3]) : "DRAW"));
                 */
                Correct += Validator(E) ? 1 : 0;
                //if (!Validator(E)) D.MakeDecision(E, true);
            }
            Console.WriteLine("{0}/{1} {2}", Correct, 500000, (double)Correct / 500000);
            Console.ReadLine();
        }
Esempio n. 2
0
        public void VerifyPlay(Card DownCard, Card Played, bool Valid)
        {
            AttributeValue[] Entry = new AttributeValue[5];
            Entry[0] = new IntegerValue(DownCard.Number);
            Entry[1] = new IntegerValue(DownCard.Suit);
            Entry[2] = new IntegerValue(Played.Number);
            Entry[3] = new IntegerValue(Played.Suit);
            Entry[4] = new BooleanValue(Valid);

            if (_Forest == null) _Forest = new Forest(1, 1, delegate(int i) { DataSet D = new DataSet(5); D.AddEntry(Entry); return D; }, 4);
            else _Forest.AddEntry(Entry);
        }