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

Create card struct #3

Closed
dnsbty opened this issue Mar 17, 2020 · 5 comments · Fixed by #9
Closed

Create card struct #3

dnsbty opened this issue Mar 17, 2020 · 5 comments · Fixed by #9
Assignees
Labels
enhancement New feature or request

Comments

@dnsbty
Copy link
Owner

dnsbty commented Mar 17, 2020

We'll want to create a struct to represent a card.

I think these should have three keys:

  • color: :red, :yellow, :green, :blue
  • number: :one through :twelve, :wild, :skip (not sure on the key for this one, open to suggestions)
  • value: one of 5, 10, 15, 25 to be used for scoring
@brettbeatty brettbeatty self-assigned this Mar 17, 2020
@brettbeatty
Copy link
Collaborator

For wild and skip, color should just be nil?

What would you think of a new/2 function like this?

Card.new(:wild)
#=> %Card{color: nil, number: :wild, value: 25}

Card.new(:seven, :blue)
#=> %Card{color: :blue, number: :seven, value: 5}

And do we want to store values on the card or just get those with a function when we need values?

@dnsbty
Copy link
Owner Author

dnsbty commented Mar 17, 2020

I looked at the official rules and it looks like a skip is technically a blue card so you can play it that way for seven cards of one color. And wilds each have a color as well but it isn’t really important for anything but display.

As far as the value though I think your idea makes sense since that’s really just a calculation based off of the number on the card. So I think the new function makes sense but we’ll want the color included every time.

@dnsbty
Copy link
Owner Author

dnsbty commented Mar 17, 2020

I guess the color wouldn’t necessarily need to be included if the first parameter is :skip but I don’t know if it’s worth making an exception for that particular case

@brettbeatty
Copy link
Collaborator

brettbeatty commented Mar 17, 2020

I didn't know that about skips

What would you think about renaming :value to :score (the concept/function since it won't be a key) and :number to :value? I don't know which I like better for the wild/skip cases

@dnsbty
Copy link
Owner Author

dnsbty commented Mar 17, 2020

Yeah I think value makes a lot more sense for that key

@dnsbty dnsbty closed this as completed in #9 Mar 17, 2020
@dnsbty dnsbty added the enhancement New feature or request label Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants