Пример #1
0
        static void Main(string[] args)
        {
            //There's no need to ask for the initial data when it already exists
            if (File.Exists("serialized.bin"))
            {
                tree = new BTTree();
            }
            else
            {
                StartNewGame();
            }

            Console.WriteLine("Output Minimax maximized: " + MiniMax(tree.GetRootNode(), true) + " (with " + calls + " calls)");
            calls = 0;
            Console.WriteLine("Output Minimax + AB Pruning maximized: " + MiniMaxABPruning(tree.GetRootNode(), true, int.MinValue, int.MaxValue) + " (with " + calls + " calls)");


            foreach (BTNode node in leafs)
            {
                Console.WriteLine(node.GetMessage());
            }

            Console.WriteLine("\nStarting the \"20 Binary Questions\" Game!\nThink of an object, person or animal.");
            tree.Query(); //play one game
            while (PlayAgain())
            {
                Console.WriteLine("\nThink of an object, person or animal.");
                Console.WriteLine();
                tree.Query(); //play one game
            }
        }