24 lines
425 B
Go
24 lines
425 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type deck []string
|
|
|
|
func (d deck) print() {
|
|
for i, card := range d {
|
|
fmt.Println(i, card)
|
|
}
|
|
}
|
|
|
|
func newDeck() deck {
|
|
cards := deck{}
|
|
cardSuits := []string{"Spades", "Diamonds", "Hearts", "Clubs"}
|
|
cardValues := []string{"Ace", "Two", "Three", "Four"}
|
|
for _, suite := range cardSuits {
|
|
for _, value := range cardValues {
|
|
cards = append(cards, value+" of "+suite)
|
|
}
|
|
}
|
|
return cards
|
|
}
|