public override Piece GetCopy() { Bishop pieceCopy = new Bishop(this.IsWhite, this.Position.Column); pieceCopy.HasMoved = this.HasMoved; pieceCopy.Piecesign = this.Piecesign; pieceCopy.Position = this.Position; pieceCopy.AttackPath = this.AttackPath; pieceCopy.MovePath = this.MovePath; pieceCopy.IsWhite = this.IsWhite; pieceCopy.biDirectional = this.biDirectional; return(pieceCopy); }
void promotionChoise(bool white, Position piecePos) { Console.WriteLine("Your pawn has reached the end and can become another piece, would you like a Queen? \nPress y or n for another piece: "); char userChoise = Console.ReadLine().ToLower()[0]; if (userChoise == 'y') { Queen queen = new Queen(white); queen.Position = piecePos; Board[piecePos.Row, piecePos.Column] = queen; updatePaths(); } else { Console.WriteLine("Then please enter the key of your desired piece (r-Rook b-Bihsop k-Knight) and press ENTER: "); string userInput = Console.ReadLine().ToLower(); userChoise = (userInput != null) ? userInput[0] : ' '; switch (userChoise) { case 'r': Rook rook = new Rook(white, 0); rook.Position = piecePos; Board[piecePos.Row, piecePos.Column] = rook; updatePaths(); break; case 'b': Bishop bishop = new Bishop(white, 0); bishop.Position = piecePos; Board[piecePos.Row, piecePos.Column] = bishop; updatePaths(); break; case 'k': Knight knight = new Knight(white, 0); knight.Position = piecePos; Board[piecePos.Row, piecePos.Column] = knight; updatePaths(); break; default: promotionChoise(white, piecePos); break; } } }