Skip to content

Commit d931d06

Browse files
committed
Add 牌型比较
1 parent b5afbdb commit d931d06

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

consts.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
CardsCount = 52
2424
PerPlayerCardCount = 5
2525

26-
Niu0 = 0
26+
NotNiu = 0
2727
Niu1 = 1
2828
Niu2 = 2
2929
Niu3 = 3

utils.go

+17
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,20 @@ func SortCards(cards []CardInfo) []CardInfo {
114114
}
115115
return cards
116116
}
117+
118+
func BankerIsWin(bankerCards, otherCards []CardInfo) bool {
119+
bankerType := GetNiuType(bankerCards)
120+
otherType := GetNiuType(bankerCards)
121+
if bankerType != otherType {
122+
return bankerType > otherType
123+
}
124+
switch bankerType {
125+
case SmallNiu:
126+
return true
127+
case Bomb:
128+
return bankerCards[2].CardValue > otherCards[2].CardValue
129+
case GoldNiu, SilverNiu, NiuNiu, NotNiu:
130+
return CompareCards(bankerCards[4], otherCards[4])
131+
}
132+
return true
133+
}

0 commit comments

Comments
 (0)