核心算法:
type Cards []byte
// todo 两对和四张起脚牌的判定
var StraightMask = []uint16{15872, 7936, 3968, 1984, 992, 496, 248, 124, 62, 31}
//顺子(Straight,亦称“蛇”)
//此牌由五张顺序扑克牌组成。
//平手牌:如果不止一人抓到此牌,则五张牌中点数最大的赢得此局,
// 如果所有牌点数都相同,平分彩池。
func (this *Cards) straight() uint32 {
var handvalue uint16
for _, v := range (*this) {
value := v & 0xF
if value == 0xE {
handvalue |= 1
}
handvalue |= (1 << (value - 1 ) )
}
for i := uint8(0); i < 10; i++ {
if handvalue&StraightMask[i] == StraightMask[i] {
return En(STRAIGHT, uint32(10-i+4))
}
}
return 0
}
//同花顺(Straight Flush)
//五张同花色的连续牌。
//平手牌:如果摊牌时有两副或多副同花顺,连续牌的头张牌大的获得筹码。
//如果是两副或多副相同的连续牌,平分筹码。
func (this *Cards) straightFlush() uint32 {
cards := *this
for i := byte(0); i < SUITSIZE; i++ {
var handvalue uint16
for _, v := ran