/// <summary>
        /// Builds the tree
        /// </summary>
        /// <returns>tree</returns>
        static MinimaxTree <Configuration> BuildTree()
        {
            // build root node
            binContents.Clear();
            binContents.Add(3); //3,2;2,1;1,0
            binContents.Add(2); //2,2;2,2;0,0
            binContents.Add(1); //1,1;0,0;0,0
            Configuration rootConfiguration =
                new Configuration(binContents);

            // build complete tree
            MinimaxTree <Configuration> tree =
                new MinimaxTree <Configuration>(rootConfiguration);
            LinkedList <MinimaxTreeNode <Configuration> > nodeList =
                new LinkedList <MinimaxTreeNode <Configuration> >();

            nodeList.AddLast(tree.Root);
            while (nodeList.Count > 0)
            {
                MinimaxTreeNode <Configuration> currentNode =
                    nodeList.First.Value;
                nodeList.RemoveFirst();
                List <Configuration> children =
                    GetNextConfigurations(currentNode.Value);
                foreach (Configuration child in children)
                {
                    MinimaxTreeNode <Configuration> childNode =
                        new MinimaxTreeNode <Configuration>(
                            child, currentNode);
                    tree.AddNode(childNode);
                    nodeList.AddLast(childNode);
                }
            }
            return(tree);
        }
        /// <summary>
        /// Executes minimax search
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // build and mark the tree with minimax scores
            MinimaxTree <Configuration> tree = BuildTree();

            Minimax(tree.Root, true);

            // find child node with maximum score
            IList <MinimaxTreeNode <Configuration> > children =
                tree.Root.Children;
            MinimaxTreeNode <Configuration> maxChildNode = children[0];

            for (int i = 1; i < children.Count; i++)
            {
                if (children[i].MinimaxScore > maxChildNode.MinimaxScore)
                {
                    maxChildNode = children[i];
                }
            }

            Console.WriteLine("Best move is to configuration " +
                              maxChildNode.Value);
            Console.WriteLine();
        }