private bool BeatsCardTrumpf(Card card, Trumpf trumpf) { if (Suit.Equals(trumpf.Suit)) { // This card is trumpf if (card.Suit.Equals(trumpf.Suit)) { // Comparing two trumpfs return(CompareToTrumpfOrder(card) > 0); } else { // Trumpf always beats non-trumpf return(true); } } else { // This card is not trumpf if (card.Suit.Equals(trumpf.Suit)) { // Other card is trumpf return(false); } else { // Both cards are non-trumpf return(CompareTo(card) > 0); } } }
public bool BeatsCard(Card card, Trumpf trumpf) { if (TrumpfMode.TRUMPF.Equals(trumpf.Mode)) { return(BeatsCardTrumpf(card, trumpf)); } else if (TrumpfMode.OBEABE.Equals(trumpf.Mode)) { return(BeatsCardObeabe(card)); } else if (TrumpfMode.UNDEUFE.Equals(trumpf.Mode)) { return(BeatsCardUndeufe(card)); } else { throw new ArgumentException("Unexpected " + trumpf.Mode); } }
public CardComparer(Trumpf trumpf) { _trumpf = trumpf; }
public bool IsTrumpf(Trumpf trumpf) { return(trumpf.Mode.Equals(TrumpfMode.TRUMPF) && Suit.Equals(trumpf.Suit)); }
/** * Allows to sort cards by their strength given a certain trumpf. */ public static IComparer <Card> GetComperatorForTrumpf(Trumpf trumpf) { return(new CardComparer(trumpf)); }