示例#1
0
        private static void PromptForRunType()
        {
            while (true)
            {
                Console.WriteLine("Press 1 for Auto: Press 2 for Manual: Press 3 to close:");
                string line = Console.ReadLine();
                if (line == "1")
                {
                    do
                    {
                        while (!Console.KeyAvailable)
                        {
                            Console.Clear();
                            b.DisplayBoard(x);
                            b.ChangeState();
                            x = b.GetBoard();
                            Thread.Sleep(500);
                        }
                    } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
                }

                if (line == "2")
                {
                    while (true)
                    {
                        Console.WriteLine("Press 1 to move to next board: Press 2 to stop:");
                        string line3 = Console.ReadLine();
                        if (line3 == "1")
                        {
                            Console.Clear();
                            b.DisplayBoard(x);
                            b.ChangeState();
                            x = b.GetBoard();
                        }
                        if (line3 == "2")
                        {
                            break;
                        }
                    }
                }
                if (line == "3")
                {
                    break;
                }
            }
        }