public static List<Move> AllPossiblePromotions(Board board, Piece piece, Coordinate square) { var moves = new List<Move>(); Move move = new Promote(board, piece, square, Promote.PromotionType.Queen); moves.Add(move); move = new Promote(board, piece, square, Promote.PromotionType.Rook); moves.Add(move); move = new Promote(board, piece, square, Promote.PromotionType.Bishop); moves.Add(move); move = new Promote(board, piece, square, Promote.PromotionType.Knight); moves.Add(move); return moves; }
public Promote(Board board, Piece piece, Coordinate to, PromotionType type) : base(board, piece, to) { var color = piece.Color; switch (type) { case PromotionType.Queen: PromotedPiece = new Queen(to, piece.Color); break; case PromotionType.Rook: PromotedPiece = new Rook(to, piece.Color); break; case PromotionType.Bishop: PromotedPiece = new Bishop(to, piece.Color); break; case PromotionType.Knight: PromotedPiece = new Knight(to, piece.Color); break; default: break; } }
public Move(Piece piece) { Piece = piece; From = piece.From; }
public ShortCastle(Piece piece) : base(piece) { To = piece.Color == Color.White ? Coordinate.g1 : Coordinate.g8; }
public Ordinary(Board board, Piece piece, Coordinate to) : base(piece) { To = to; CapturedPiece = To.GetPiece(board); }
public EnPassant(Board board, Piece piece,Coordinate to) : base(board,piece,to) { }
public LongCastle(Piece piece) : base(piece) { To = piece.Color == Color.White ? Coordinate.c1 : Coordinate.c8; }