예제 #1
0
 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;
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 public Move(Piece piece)
 {
     Piece = piece;
     From = piece.From;
 }
예제 #4
0
 public ShortCastle(Piece piece)
     : base(piece)
 {
     To = piece.Color == Color.White ? Coordinate.g1 : Coordinate.g8;
 }
예제 #5
0
 public Ordinary(Board board, Piece piece, Coordinate to)
     : base(piece)
 {
     To = to;
     CapturedPiece = To.GetPiece(board);
 }
예제 #6
0
 public EnPassant(Board board, Piece piece,Coordinate to)
     : base(board,piece,to)
 {
 }
예제 #7
0
 public LongCastle(Piece piece)
     : base(piece)
 {
     To = piece.Color == Color.White ? Coordinate.c1 : Coordinate.c8;
 }