Example #1
0
        static void Main(string[] args)
        {
            Console.Title = "Ryan's Chess";
            //initilize board and pl1 going first
            Board board = new Board();

            Board.Team player = Board.Team.White;

            Console.WriteLine("Welcome to a game of Chess");
            board.PrintBoard();
            while (!board.gameOver)
            {
                string source      = "";
                string destination = "";
                do
                {
                    do
                    {
                        Console.WriteLine(player.ToString() + " enter source Piece (e.i A4): ");
                        source = Console.ReadLine().Trim().ToUpper();
                    } while (!board.AvailableSource(player, source));
                    //check if good peice
                    Console.WriteLine(player.ToString() + " enter destination (e.i. H7): ");
                    destination = Console.ReadLine().Trim().ToUpper();
                } while (!board.ExecuteMove(player, source, destination));
                //change player
                player = Board.Team.Black == player ? Board.Team.White : Board.Team.Black;
                board.PrintBoard();
            }
            Console.WriteLine(string.Format("{0} team wins!", Board.Team.Black == player ? Board.Team.White.ToString() : Board.Team.Black.ToString()));
            Console.ReadLine();
        }