public class Card
{
    int suit, rank;

    // simple constructor
    public Card () { 
	this.suit = 0;  this.rank = 0;
    }

    // constructor with arguments
    public Card (int suit, int rank) { 
	this.suit = suit;  this.rank = rank;
    }

    // printCard: speaks for itself
    public static void printCard (Card c) {
	String[] suits = { "Clubs", "Diamonds", "Hearts", "Spades" };
	String[] ranks = { "narf", "Ace", "2", "3", "4", "5", "6",
			   "7", "8", "9", "10", "Jack", "Queen", "King" };

	System.out.println (ranks[c.rank] + " of " + suits[c.suit]);
    }

    // compareCards: takes two cards and returns 1 if the first
    // is greater, -1 if the second is greater, and 0 if they
    // contain the same values (deep equality)
    public static int compareCards (Card c1, Card c2) {
	if (c1.suit > c2.suit) return 1;
	if (c1.suit < c2.suit) return -1;

	// rotate the ranks so Ace is high
	int c1rank = (c1.rank+11) % 13;
	int c2rank = (c2.rank+11) % 13;

	if (c1rank > c2rank) return 1;
	if (c1rank < c2rank) return -1;    
	return 0;
    }
    
    // sameCard: compares the contents of two cards (deep equality)
    public static boolean sameCard (Card c1, Card c2) {
	return (c1.suit == c2.suit && c1.rank == c2.rank);
    }
}
