Exemplo n.º 1
0
 public static void printMatch(XadrezGame match)
 {
     printBoard(match.bor);
     Console.WriteLine();
     printPieceCapture(match);
     Console.WriteLine();
     Console.WriteLine("Round: " + match.round);
     Console.WriteLine("Waiting played pieces " + match.CurrentePlayer);
 }
Exemplo n.º 2
0
        public static void printPieceCapture(XadrezGame match)
        {
            Console.WriteLine("Captured pieces");
            Console.Write("White: ");
            printAssembli(match.pieceCaptured(Color.White));
            Console.Write("Black: ");
            ConsoleColor aux = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Yellow;
            printAssembli(match.pieceCaptured(Color.Black));
            Console.ForegroundColor = aux;
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            try
            {
                XadrezGame game = new XadrezGame();
                while (!game.Finish)
                {
                    try
                    {
                        Console.Clear();
                        Screen.printMatch(game);

                        Console.WriteLine();
                        Console.Write("Origin: ");
                        Position origin = Screen.readPositionXadrez().toPosition();
                        game.validPositionTheOrigin(origin);
                        bool[,] positionPosible = game.bor.piece(origin).movimetsPosible();

                        Console.Clear();
                        Screen.printBoard(game.bor, positionPosible);



                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine();

                        Console.Write("Destination: ");
                        Position destination = Screen.readPositionXadrez().toPosition();
                        game.validateTargetPosition(origin, destination);

                        game.gamedPerforms(origin, destination);
                    }
                    catch (BoardException c)
                    {
                        Console.WriteLine(c.Message);
                        Console.WriteLine("Press enter to continue!");
                        Console.ReadLine();
                    }
                }
                Screen.printBoard(game.bor);
            }
            catch (BoardException e)
            {
                Console.WriteLine(e.Message);
            }
        }