From 2fb75da43e6d1d6cd86c1c7da1aa6a71c8ee3e0f Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 29 Nov 2024 18:01:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=81=E4=B8=89=E5=BC=A0?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E7=89=8C=E5=9E=8B=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamerule/thirteen/logic.go | 12 +++++++++--- gamerule/thirteen/logic_test.go | 11 +++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gamerule/thirteen/logic.go b/gamerule/thirteen/logic.go index e0cd97a..9a72eaa 100644 --- a/gamerule/thirteen/logic.go +++ b/gamerule/thirteen/logic.go @@ -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++ diff --git a/gamerule/thirteen/logic_test.go b/gamerule/thirteen/logic_test.go index 729d406..2679cdf 100644 --- a/gamerule/thirteen/logic_test.go +++ b/gamerule/thirteen/logic_test.go @@ -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[:]))