C# Class Belot.CardComparer

Compares two cards according to a given announcement.
This is needed for sorting purposes. For example Jack is bigger than Ace in game of All Trumps but in game of No Trumps is smaller.
Inheritance: IComparer
Mostra file Open project: NikolayIT/BelotGameEngine Class Usage Examples

Public Methods

Method Description
CardComparer ( AnnouncementTypeEnum announcementType ) : System

Constructor for the class. Creates a new CardComparer object.

Compare ( object x, object y ) : int

Compares two cards

Private Methods

Method Description
CardComparer ( ) : System

Constructor for the class. Creates a new CardComparer object. Compares in such order 7,8,9,10,J,Q,K,A

CompareCombinations ( Card cardX, Card cardY ) : int

Compares in such order 7,8,9,10,J,Q,K,A

CompareNoTrumps ( Card cardX, Card cardY ) : int

Compares in such order 7,8,9,J,Q,K,10,A

CompareTrumps ( Card cardX, Card cardY ) : int

Compares in such order 7,8,Q,K,10,A,9,J

Method Details

CardComparer() public method

Constructor for the class. Creates a new CardComparer object.
public CardComparer ( AnnouncementTypeEnum announcementType ) : System
announcementType AnnouncementTypeEnum
return System

Compare() public method

Compares two cards
public Compare ( object x, object y ) : int
x object First card
y object Second card
return int