public override int CompareTo( object combination )
{
if( !(combination is SequentialCombination) )
{
throw new InvalidOperationException( "Cannot compare SequentialCombination to an object of different type" );
}
int result = 0;
SequentialCombination comb = combination as SequentialCombination;
if( this.Points > comb.Points )
{
result = 1;
}
else if( this.Points < comb.Points )
{
result = -1;
}
else
{
// both combinations are sequential. See biggest card
CardComparer comparer = new CardComparer( );
this.Cards.Sort( comparer );
comb.Cards.Sort( comparer );
result = comparer.Compare( this.Cards[0], comb.Cards[0] );
}
return result;
}