-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added Win Message #15
base: main
Are you sure you want to change the base?
Conversation
card := toDeck.Top().String() | ||
cardArr := strings.Split(card, "") | ||
if cardArr[0] == "K" { | ||
kings[card] = true | ||
} | ||
if len(kings) == 4 { | ||
fmt.Println("You Won!") | ||
os.Exit(0) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure your indentation is correct!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that
@@ -179,6 +185,15 @@ func (s *Solitaire) move(to *index) bool { | |||
if s.selected.card == fromDeck.Size()-1 && toDeck.Size() == 0 && fromDeck.Top().Value == 0 || toDeck.Size() > 0 && fromDeck.Top().Value == toDeck.Top().Value+1 && fromDeck.Top().Suit == toDeck.Top().Suit { | |||
s.toggleSelect(s.selected) | |||
toDeck.Add(fromDeck.Pop()) | |||
card := toDeck.Top().String() | |||
cardArr := strings.Split(card, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to do this, card[0]
should give us the same value as cardArr[0]
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is but i didn't want to convert it to a char. But yes it would be better to do it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was meant for my personal use because i wanted to get a victory message, i thought i'll try sending you a pull request if you maybe wanted to add it in.
I added a super simple victory message when the user reaches 4 kings.