//private static Menu[] menus;
        static void Main(string[] args)
        {
            instructions = new Menu(new Dictionary<string, Action>(), State.Instructions,
                "Welcome to the console version of Accelerated Delivery. This game functions on a turn-based system. Each turn, you will get three actions to use to activate machines, spawn boxes, or simply wait. Machines may move instantly, or they make take multiple turns to move their distance. Every machine and belt has a capacity, which, if exceeded, will cause it to lose boxes. Belts have multiple \"segments\", through which boxes will advance each turn. You'll pick it up if you just start playing.");

            extras = new Menu(new Dictionary<string, Action>(), State.Extras, "This doesn't work yet.");
            options = new Menu(new Dictionary<string, Action>(), State.Options, "This doesn't work yet.");
            levelSelect = new Menu(new Dictionary<string, Action>(), State.LevelSelect, "This doesn't work yet.");
            achievements = new Menu(new Dictionary<string, Action>(), State.Achievements, "This doesn't work yet.");

            mainMenu = new Menu(new Dictionary<string, Action> {
                { "Start Game", () => { loadLevel(1, State.Main); } },
                { "Instructions", () => { instructions.EnterMenuLoop(State.Main); } },
                { "Level Select", () => { levelSelect.EnterMenuLoop(State.Main); } },
                { "Extras", () => { extras.EnterMenuLoop(State.Main); } }
                    }, State.Main);

            //menus = new Menu[5];
            //menus[0] = mainMenu;
            //menus[1] = levelSelect;
            //menus[2] = extras;
            //menus[3] = options;
            //menus[4] = achievements;

            Console.WriteLine("                             WELCOME TO ACCELERATED DELIVERY");
            Console.WriteLine("Please select an option:");
            mainMenu.EnterMenuLoop(State.None); // and so it begins
        }
        public Menu(Dictionary<string, Action> entries, Program.State state)
        {
            this.state = state;

            if(entries.Count > 9)
            {
                Dictionary<string, Action> newEntries = new Dictionary<string, Action>();
                Dictionary<string, Action> childEntries = new Dictionary<string, Action>();
                int i = 0;
                foreach(KeyValuePair<string, Action> pair in entries)
                {
                    if(i < 9)
                    {
                        i++;
                        newEntries.Add(pair.Key, pair.Value);
                    }
                    else
                    {
                        i++;
                        childEntries.Add(pair.Key, pair.Value);
                    }
                }
                childMenu = new Menu(childEntries, Program.State.ChildMenu);
                childMenu.isChild = true;
                childMenu.parent = this;
                this.entries = newEntries;
            }
            else
                this.entries = entries;
        }
        public virtual void EnterMenuLoop(Program.State previousState)
        {
            Program.CurrentState = state;
            done = false;

            while(!done)
            {
                doPrePrintProcessing();

                printEntries(previousState);
                int key = Console.Read();
                Console.ReadLine();
                key -= 48;
                if((key >= 1 || (key == 0 && ((isChild && entries.Count == 8) || entries.Count == 9))) && ((key - 1 <= entries.Count || (key - 2 <= entries.Count && isChild)) || entries.Count == 0))
                {
                    if((key - 1 == entries.Count || (isChild && key - 2 == entries.Count)) || entries.Count == 0 || key == 0)
                    {
                        if((isChild && (key == 0) || key - 1 == entries.Count) || !isChild)
                        {
                            if(childMenu == null)
                            {
                                done = true;

                                Program.CurrentState = previousState;
                            }
                            else
                                childMenu.EnterMenuLoop(previousState);
                        }
                        else if(isChild && key - 2 == entries.Count)
                        {
                            done = true;
                            parent.done = true;
                            Menu originalParent = parent;
                            while(parent.parent != null)
                            {
                                parent = parent.parent;
                                parent.done = true;
                            }
                            parent = originalParent;
                        }
                    }
                    else
                    {
                        entries.ElementAt(key - 1).Value();

                        doPostInputProcessing();

                        if(singleChoice)
                            done = true;
                    }
                }
                else
                    Console.WriteLine("Invalid input.");
            }
            done = false;
        }