/// <summary> /// Generate PieceState from a Piece. /// </summary> /// <param name="piece"><see cref="Piece"/></param> public PieceState(Piece piece) { PieceType = piece.Type; SquareId = !piece.Captured ? piece.Square.Id : String.Empty; }
/// <summary> /// Instantiate <see cref="Set"/> /// </summary> /// <param name="color"><see cref="Color"/></param> public Set(PieceColor color) { _color = color; _king = new Piece(PieceType.King, color); _queen = new Piece(PieceType.Queen, color); _rookA = new Piece(PieceType.Rook, color); _rookH = new Piece(PieceType.Rook, color); _knightB = new Piece(PieceType.Knight, color); _knightG = new Piece(PieceType.Knight, color); _bishopC = new Piece(PieceType.Bishop, color); _bishopF = new Piece(PieceType.Bishop, color); _pawnA = new Piece(PieceType.Pawn, color); _pawnB = new Piece(PieceType.Pawn, color); _pawnC = new Piece(PieceType.Pawn, color); _pawnD = new Piece(PieceType.Pawn, color); _pawnE = new Piece(PieceType.Pawn, color); _pawnF = new Piece(PieceType.Pawn, color); _pawnG = new Piece(PieceType.Pawn, color); _pawnH = new Piece(PieceType.Pawn, color); _pieces = new List<Piece> { _king, _queen, _rookA, _rookH, _knightB, _knightG, _bishopC, _bishopF, _pawnA, _pawnB, _pawnC, _pawnD, _pawnE, _pawnF, _pawnG, _pawnH, }; }