Ejemplo n.º 1
0
        public void TakeInput()
        {
            string startCoord;
            string endCoord;

            Console.WriteLine(this.player.CurrentPlayer() + " Enter Your Move");
            Console.Write("Starting Coordinate : ");
            startCoord = Console.ReadLine();
            Console.Write("Ending Coordinate : ");
            endCoord = Console.ReadLine();
            if (startCoord == endCoord)
            {
                StartGame();
            }
            else
            {
                Coordinate start = FindXY(startCoord);
                Coordinate end   = FindXY(endCoord);
                if (CheckValidColor(start))
                {
                    if (CheckValidMove(start, end) == true)
                    {
                        {
                            char temp = board.GetCoord(start.GetX(), start.GetY());
                            if (board.GetCoord(end.GetX(), end.GetY()) == 'K' || board.GetCoord(end.GetX(), end.GetY()) == 'k')
                            {
                                GameOver();
                                return;
                            }
                            board.SetCoord(end.GetX(), end.GetY(), temp);
                            board.SetCoord(start.GetX(), start.GetY(), 'X');
                        }

                        this.player.ChangePlayer();
                        StartGame();
                    }
                    else
                    {
                        Console.WriteLine("Invalid Move in");
                        StartGame();
                    }
                }
                else
                {
                    Console.WriteLine("Invalid Move out");
                    StartGame();
                }
            }
        }