package qznn

type Card struct {
	Suit int //1-4,表示花色
	Num  int //1-13,表示数字
}

type NNCardList struct {
	Card1 Card
	Card2 Card
	Card3 Card
	Card4 Card
	Card5 Card
}

func GetNNCardList(cardList NNCardList) []uint32 {
	return []uint32{
		uint32(cardList.Card1.Num + 13*(cardList.Card1.Suit-1)),
		uint32(cardList.Card2.Num + 13*(cardList.Card2.Suit-1)),
		uint32(cardList.Card3.Num + 13*(cardList.Card3.Suit-1)),
		uint32(cardList.Card4.Num + 13*(cardList.Card4.Suit-1)),
		uint32(cardList.Card5.Num + 13*(cardList.Card5.Suit-1)),
	}
}

func GetNNCardListLimit(cardList NNCardList, count int) []uint32 {
	if count == 0 {
		return []uint32{}
	}

	listItem := GetNNCardList(cardList)
	switch count {
	case 0:
		return []uint32{}
	case 1:
		return listItem[0:1]
	case 2:
		return listItem[0:2]
	case 3:
		return listItem[0:3]
	case 4:
		return listItem[0:4]
	case 5:
		return listItem[0:5]
	default:
		panic("数量异常")
	}
}

func CardList2NNCardList(cardList []Card) NNCardList {
	nnCardList := NNCardList{
		Card1: cardList[0],
		Card2: cardList[1],
		Card3: cardList[2],
		Card4: cardList[3],
		Card5: cardList[4],
	}

	return nnCardList
}
