示例#1
0
        public void Run()
        {
            Console.WriteLine();

            while (true)
            {
                board.Print();
                Move        currentMove = GetUserInput();
                MoveOutcome result      = TryPerformMove(currentMove);

                switch (result)
                {
                case MoveOutcome.BlackWins:
                    Console.WriteLine("Black wins");
                    return;

                case MoveOutcome.WhiteWins:
                    Console.WriteLine("White wins");
                    return;

                case MoveOutcome.Illegal:
                    Console.Clear();
                    Console.WriteLine("This move is not legal");
                    break;

                case MoveOutcome.Success:
                    board.ChangeTurns();
                    Console.Clear();
                    Console.WriteLine();
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }