rust-exercises
rust-exercises copied to clipboard
Card Deck based exercises
A deck of cards is an interesting way to show ownership, because a deck has 52 cards and cards cannot be cloned or copied (unless you are cheating). The suits and face values also lend themselves to enumerations.
enum Suit {
Hearts,
Diamonds,
Clubs,
Spades
}
enum FaceValue {
Ace,
King,
Queen,
Jack,
Ten,
Nine,
Eight,
Seven,
Six,
Five,
Four,
Three,
Two
}
There's also an interesting aside about manually implementing Ord but handling whether Aces are High or Low.
This is an awesome idea. But we'll have to schedule this for the next round