Example #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;
 }
Example #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;
     }
 }
Example #3
0
 protected Piece(Coordinate from, Color color)
 {
     From = from;
     Color = color;
 }
Example #4
0
 /// <summary>
 /// piece goes specified square
 /// </summary>
 /// <param name="board"></param>
 /// <param name="to"></param>
 public void MoveTo(Board board, Coordinate to)
 {
     RemoveMe(board);
     board[to] = this;
     From = to;
 }
Example #5
0
 public Pawn(Coordinate from, Color color)
     : base(from, color)
 {
 }
Example #6
0
 public Rook(Coordinate from, Color color)
     : base(from, color)
 {
 }
Example #7
0
 public Queen(Coordinate from, Color color)
     : base(from, color)
 {
 }
Example #8
0
 public Knight(Coordinate from, Color color)
     : base(from, color)
 {
 }
Example #9
0
 public EnPassant(Board board, Piece piece,Coordinate to)
     : base(board,piece,to)
 {
 }
Example #10
0
 public Bishop(Coordinate from, Color color)
     : base(from, color)
 {
 }