Пример #1
0
        public void ShowPieces()
        {
            ColorWriter blacktowhite = new ColorWriter()
            {
                ForeGroundColor = ConsoleColor.Black, BackGroundColor = ConsoleColor.White
            };
            int left;
            int top;

            left = Console.CursorLeft;
            top  = Console.CursorTop;
            //3, 8, 13 -> +5
            //13, 15
            int position_left = 3;
            int position_top  = 1;

            foreach (ChessPiece chessPiece1 in chessPieces)
            {
                Console.WriteLine(chessPiece1.ToString());
            }

            foreach (ChessPiece chessPiece in chessPieces)
            {
                for (int i = 0; i < 2; i++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        for (int j = 0; j < 8; j++)
                        {
                            Console.SetCursorPosition(position_left, position_top);
                            //if ob weiß oder black und dann entsprechende color setzen
                            if (chessPiece.IsWhite.Equals(true))
                            {
                                blacktowhite.Write(chessPiece.ShortName);
                            }
                            else if (chessPiece.IsWhite.Equals(false))
                            {
                                Console.Write(chessPiece.ShortName);
                            }
                            position_left += 5;
                        }
                        position_top += 2;
                        position_left = 3;
                    }
                    position_top = 13;
                }
            }

            Console.SetCursorPosition(left, top);
        }
Пример #2
0
        public void Show()
        {
            ColorWriter blacktogrey = new ColorWriter()
            {
                ForeGroundColor = ConsoleColor.Black, BackGroundColor = ConsoleColor.Gray
            };

            Console.Write(" ");
            blacktogrey.WriteLine("-----------------------------------------");
            for (fields = 8; fields > 1; fields--)
            {
                Console.Write($"{fields}");
                blacktogrey.WriteLine("|    |    |    |    |    |    |    |    |");
                Console.Write(" ");
                blacktogrey.WriteLine("|----+----+----+----+----+----+----+----|");
            }
            Console.Write($"{fields}");
            blacktogrey.WriteLine("|    |    |    |    |    |    |    |    |");
            Console.Write(" ");
            blacktogrey.WriteLine("-----------------------------------------");
            Console.WriteLine("   a    b    c    d    e    f    g    h");
            ShowPieces();
            //in dieser klasse methode mit, zielfeld leer oder nicht, auf Startfeld Figur, ...
        }