Skip to content

Commit

Permalink
prob need this distinction
Browse files Browse the repository at this point in the history
  • Loading branch information
codeslinger committed May 13, 2012
1 parent 6832881 commit be66ef2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion card.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,24 @@ func (card Card) Suit() Suit {
return NoSuit
}

// Compare two cards, returning:
// Compare two cards by rank only, returning:
// 1 if this card is higher
// -1 if the other card is higher, or
// 0 if they represent the same card.
func (card Card) Compare(other Card) int {
if card.Rank() > other.Rank() {
return 1
} else if card.Rank() < other.Rank() {
return -1
}
return 0
}

// Compare two cards by rank first and then suit, returning:
// 1 if this card is higher
// -1 if the other card is higher, or
// 0 if they represent the same card.
func (card Card) FullCompare(other Card) int {
if card.Rank() > other.Rank() {
return 1
} else if card.Rank() < other.Rank() {
Expand Down

0 comments on commit be66ef2

Please sign in to comment.