public Card(RANK rank,SUIT suit) { this.rank = (int)rank; this.suit = (int)suit; faceUp = false; highlight = false; }
public Card(RANK rank, SUIT suit,bool faceUp) { this.rank = (int)rank; this.suit = (int)suit; this.faceUp = faceUp; highlight = false; }
private Card FromString(string cardStr) { RANK rank = (RANK)Enum.Parse(typeof(RANK), "R" + cardStr.Split('_')[1]); SUIT suit = (SUIT)Enum.Parse(typeof(SUIT), cardStr.Split('_')[0]); return(new Card(rank, suit)); }
public Card(RANK rank, SUIT suit) { this.rank = (int)rank; this.suit = (int)suit; faceUp = false; highlight = false; }
/// <summary> /// Converts a string suit to the suit value /// </summary> /// <param name="suit">The inputted suit</param> /// <returns>Suit</returns> public SUIT ConvertToSuit(string suit) { SUIT tempSuit = SUIT.HEARTS; switch (suit.ToUpper()) { case "H": tempSuit = SUIT.HEARTS; break; case "S": tempSuit = SUIT.SPADES; break; case "D": tempSuit = SUIT.DIAMONDS; break; case "C": tempSuit = SUIT.CLUBS; break; } return(tempSuit); }
public Card(RANK rank, SUIT suit, bool faceUp) { this.rank = (int)rank; this.suit = (int)suit; this.faceUp = faceUp; highlight = false; }
public BlackjackCard(SUIT suit, int faceValue) : base(suit, faceValue) { this.GameValue = faceValue; if (this.GameValue > 10) { this.GameValue = 10; } }
public Card(int idx) { _iCard = idx; _iSuit = idx / 13; _iRank = idx % 13; _eSUIT = (SUIT)(0x10000 << _iSuit); _eRANK = (RANK)(0x1 << _iRank); }
public bool HasCardOfSuit(SUIT suit) { foreach (Card c in Cards) { if (c.Suit == suit && c.card_state == Card.CARD_STATE.IN_HAND) { return(true); } } return(false); }
private static bool SameSuit(params Card[] list) { SUIT s = list[0].suit; for (int i = 0; i < list.Length; i++) { if (s != list[i].suit) { return(false); } } return(true); }
public string SuitString(SUIT suit) { switch (suit) { default: return(""); case SUIT.D: return("D"); // "♦"; case SUIT.C: return("C"); // "♣"; case SUIT.H: return("H"); // "♥"; case SUIT.S: return("S"); // "♠"; } }
public Card[] GetLegalMoves(bool firstTrick, bool heartsBroken, SUIT startingSuit, int CurrentPlaceInTrick) { List <Card> legalCards = new List <Card>(); SetLegalMoves(firstTrick, heartsBroken, startingSuit, CurrentPlaceInTrick); foreach (Card c in Cards) { if (c.isLegal) { legalCards.Add(c); } } return(legalCards.ToArray()); }
public Card(string _cardName) { switch (_cardName[_cardName.Length - 1]) { case 'D': m_suit = SUIT.DIAMOND; break; case 'H': m_suit = SUIT.HEART; break; case 'C': m_suit = SUIT.CLUB; break; case 'S': m_suit = SUIT.SPADE; break; default: throw new Exception("Unsupported suit character!"); } _cardName = _cardName.Substring(0, _cardName.Length - 1); switch (_cardName) { case "2": m_value = 0; break; case "3": m_value = 1; break; case "4": m_value = 2; break; case "5": m_value = 3; break; case "6": m_value = 4; break; case "7": m_value = 5; break; case "8": m_value = 6; break; case "9": m_value = 7; break; case "10": m_value = 8; break; case "J": m_value = 9; break; case "Q": m_value = 10; break; case "K": m_value = 11; break; case "A": m_value = 12; break; default: throw new Exception("Unsupported card type!"); } }
public Card(SUIT suit, RANK rank) { _eSUIT = suit; _eRANK = rank; switch (suit) { case SUIT.D: _iSuit = 0; break; case SUIT.C: _iSuit = 1; break; case SUIT.H: _iSuit = 2; break; case SUIT.S: _iSuit = 3; break; } switch (rank) { case RANK._2: _iRank = 0; break; case RANK._3: _iRank = 1; break; case RANK._4: _iRank = 2; break; case RANK._5: _iRank = 3; break; case RANK._6: _iRank = 4; break; case RANK._7: _iRank = 5; break; case RANK._8: _iRank = 6; break; case RANK._9: _iRank = 7; break; case RANK._T: _iRank = 8; break; case RANK._J: _iRank = 9; break; case RANK._Q: _iRank = 10; break; case RANK._K: _iRank = 11; break; case RANK._A: _iRank = 12; break; } _iCard = _iSuit * 13 + _iRank; }
public void SetLegalMoves(bool firstTrick, bool heartsBroken, SUIT startingSuit, int CurrentPlaceInTrick) { foreach (Card c in Cards) { // default all moves to illegal c.SetLegality(false); // during the first trick, hearts cannot be played if (firstTrick) { if (CurrentPlaceInTrick == 1) { if (c.IsTwoOfClubs()) { c.SetLegality(true); } } else { // if player has clubs, only clubs can be played if (HasCardOfSuit(SUIT.CLUBS)) { if (c.Suit == SUIT.CLUBS) { c.SetLegality(true); } } else { // if player doesn't have clubs, all cards apart from hearts and QoS can be played if (c.Suit != SUIT.HEARTS && !c.IsQueenOfSpades()) { c.SetLegality(true); } } } } // not the first trick else { // first player to play a card can play any card (not hearts if hearts not broken) if (CurrentPlaceInTrick == 1) { if (heartsBroken && c.card_state == Card.CARD_STATE.IN_HAND) { c.SetLegality(true); } else { if (c.Suit != SUIT.HEARTS && c.card_state == Card.CARD_STATE.IN_HAND) { c.SetLegality(true); } } } // not the first person to pick else { // see if player can match suit already played if (HasCardOfSuit(startingSuit)) { if (c.Suit == startingSuit && c.card_state == Card.CARD_STATE.IN_HAND) { c.SetLegality(true); } } // doesnt have a card of the starting suit; play anything else { if (c.card_state == Card.CARD_STATE.IN_HAND) { c.SetLegality(true); } } } } } }
public Card(RANK r, SUIT s) { rank = r; suit = s; }
public Card(string value, string suit) { Value = MapNumber(value); Suit = MapSuit(suit); }
public Card(SUIT suit, int faceValue) { this.Suit = suit; this.FaceValue = faceValue; }
public Card(int x, string file, SUIT s) { cardValue = x; fileName = file; suit = s; }
public Card(SUIT s, int n) { Suit = s; Number = n; }
public Card(SUIT suit, RANK rank) { this._suit = suit; this._rank = rank; }
public Card(SUIT suit, VALUE value) { Suit = suit; Value = value; }
/// <summary> /// Constructor that sets the suit and value properties of a card /// </summary> /// <param name="st">Suit of a card</param> /// <param name="val">Value of a card</param> public Card(SUIT st, VALUE val) { suit = st; value = val; }
public Card(Card card) { rank = card.rank; suit = card.suit; }
public Card(SUIT suit, VALUE value) { CardSuit = suit; CardValue = value; }
public Card(SUIT suit, string value) { this.Suit = suit; this.Value = value; }
public Card(RANK rank, SUIT suit) { this._rank = rank; this._suit = suit; }
public Card() { Rank = RANK.Small; Suit = SUIT.Joker; }
public void setCard(RANK rank, SUIT suit) { this.rank = (int)rank; this.suit = (int)suit; }
public Card(RANK _rank, SUIT _suit) { Rank = _rank; Suit = _suit; }
public Card(RANK rank, SUIT suit) { this.rank = rank; this.suit = suit; }
public Card(SUIT suit, RANK rank) { Suit = suit; Rank = rank; }
public Card(int v, SUIT suit) { faceValue = v; this.suit = suit; }