Exemplo n.º 1
0
func TestDeck(t *testing.T) {
	cards := jokertest.Cards("Qh", "Ks", "4s")
	actual := []*hand.Card{hand.QueenHearts, hand.KingSpades, hand.FourSpades}
	deck := jokertest.Dealer(cards).Deck()

	for i := 0; i < len(actual); i++ {
		card := deck.Pop()
		if actual[i] != card {
			t.Fatalf("Pop() = %s; want %s; i = %d", card, actual[i], i)
		}
	}
}
Exemplo n.º 2
0
func dealOut(g game, cards []*hand.Card) (holeCards []*hand.Card, board []*hand.Card) {
	deck := jokertest.Dealer(cards).Deck()
	hCards := []*HoleCard{}
	board = []*hand.Card{}

	for i := 0; i < g.NumOfRounds(); i++ {
		hCards = append(hCards, g.HoleCards(deck, round(i))...)
		board = append(board, g.BoardCards(deck, round(i))...)
	}

	holeCards = []*hand.Card{}
	for _, c := range hCards {
		holeCards = append(holeCards, c.Card)
	}
	return
}