public Card GetCard(int cardNum) { if (cardNum >= 0 && cardNum <= 51) { if ((cardNum == 51) && LastCardDrawn != null) { LastCardDrawn(this); } return(cards[cardNum]); } else { throw new CardOutOfRangeException(cards.Clone() as Cards); } }
public Card GetCard(int cardNum) { if (cardNum >= 0 && cardNum <= 51) { // Code modified in section "Expanding and Using CardLib" if ((cardNum == 51) && (LastCardDrawn != null)) { LastCardDrawn(this); } return(cards[cardNum]); } else { throw new CardOutOfRangeException(cards.Clone() as Cards); } }
public Card GetCard(int cardNum) { if (cardNum >= 0 && cardNum <= CardsNum - 1) { if (cardNum == CardsNum - 1 && LastCardDrawn != null) { LastCardDrawn(this, EventArgs.Empty); } return(cards[cardNum]); } else { //throw (new System.ArgumentOutOfRangeException("cardNum", cardNum, "Value must be between 0 to 51.")); throw new CardOutOfRangeException(cards.Clone() as Cards); } }
/// <summary> /// get card from the deck /// </summary> /// <param name="cardNum"> number of the card which will be gettn</param> /// <returns></returns> public Card GetCard(int cardNum) { if (cardNum >= 0 && cardNum < cards.Count) { if ((cardNum == cards.Count) && (LastCardDrawn != null)) { LastCardDrawn(this, EventArgs.Empty); } return(cards[cardNum]); } else { throw new CardOutOfRangeException((Cards)cards.Clone()); } }
// Accessor for a Card in the Deck public Card GetCard(int cardNum) { if (cardNum >= 0 && cardNum <= 51) { // Trigger an event if LastCardDrawn is written and the last card is drawn if ((cardNum == 51) && (LastCardDrawn != null)) { LastCardDrawn(this, EventArgs.Empty); } return(cards[cardNum]); } else { throw new CardOutOfRangeException(cards.Clone() as Cards); } }
//clones the Board cards public object Clone() { Board newBoard = new Board(theBoard.Clone() as Cards); return(newBoard); }
//clone method //returns a clone of playerhand public object Clone() { Hand newHand = new Hand(hand.Clone() as Cards); return(newHand); }
public object Clone() { Deck newDeck = new Deck(cards.Clone() as Cards); return(newDeck); }