修改十三张推荐牌型算法

This commit is contained in:
sk 2024-11-29 18:01:19 +08:00
parent 353c1904e9
commit 2fb75da43e
2 changed files with 20 additions and 3 deletions

View File

@ -612,13 +612,19 @@ func (l *Logic) findAllCombine(cards [13]int) (pokers []*Group) {
i++
}
} else if i == PokersTypeTwoPairs {
// 6,7,8 对子
// 4,5,6 两对
al := len(copyCards)
if al == 7 || al == 6 {
if al == 8 || al == 7 {
copy(poker.Mid[2:], card)
} else if al == 5 || al == 4 {
copy(poker.Mid[:], card)
} else if al == 8 {
copy(poker.Mid[:], card)
} else if al == 6 {
if poker.Mid[2] == -1 {
copy(poker.Mid[2:], card)
} else {
copy(poker.Mid[:], card)
}
} else {
copyCards = append(copyCards, card...)
i++

View File

@ -87,6 +87,17 @@ func TestFindAllPokers(t *testing.T) {
{46, 35, 30, 50, 34, 9, 25, 41, 3, 26, 2, 6, 45},
}
//
//牌序- A, K, Q, J,10, 9, 8, 7, 6, 5, 4, 3, 2
//黑桃-51,50,49,48,47,46,45,44,43,42,41,40,39
//红桃-38,37,36,35,34,33,32,31,30,29,28,27,26
//梅花-25,24,23,22,21,20,19,18,17,16,15,14,13
//方片-12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
//data = [][13]int{
// //{31, 42, 14, 49, 23, 25, 12, 6, 33, 20, 34, 21, 7},
// {13, 23, 24, 36, 37, 38, 39, 51, 51, 50, 10, 11, 12},
//}
for _, v := range data {
cards := v
fmt.Println(PokersShow(cards[:]))