Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card Deck based exercises #8

Open
jonathanpallant opened this issue May 15, 2023 · 1 comment
Open

Card Deck based exercises #8

jonathanpallant opened this issue May 15, 2023 · 1 comment

Comments

@jonathanpallant
Copy link
Member

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.

@Mirabellensaft
Copy link
Contributor

This is an awesome idea. But we'll have to schedule this for the next round

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants