Beispiel #1
0
        static GoPosition HumanPlay()
        {
            while (true)
            {
                try {
                    int x = int.Parse(GetLine()) - 1;
                    int y = 9 - int.Parse(GetLine());
                    if (x == -1 && y == 9)
                    {
                        return(boardShape.Passed());
                    }
                    if (boardShape.Valid(y, x) && game.IsLegal(boardShape.At(y, x), GameBase.Color.White))
                    {
                        game.Play(boardShape.At(y, x), GameBase.Color.White);
                        return(boardShape.At(y, x));
                    }
                }
                catch { }

                Console.WriteLine("Invalid arguments. Try Again:");
            }

            string GetLine()
            {
                string input = null;

                while (input == null)
                {
                    input = Console.ReadLine();
                }
                return(input);
            }
        }