Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeChow(value uint32) (c1, c2, c3 byte)
- func DecodeChow2(value uint32) (c1, c2 byte)
- func DecodeKong(value uint32) (seat uint32, card byte, v uint32)
- func DecodePeng(value uint32) (seat uint32, card byte)
- func DetectKong(cs []byte, ps []uint32, wildcard byte) (status int64)
- func DiscardChow(s1, s2 uint32, card byte, cs []byte, wildcard byte) (status int64)
- func DiscardPong(card byte, cs []byte, wildcard byte) (status int64)
- func EncodeChow(c1, c2, c3 byte) (value uint32)
- func EncodeKong(seat uint32, card byte, value uint32) uint32
- func EncodePeng(seat uint32, card byte) uint32
- func Exist(c byte, cs []byte, n int) bool
- func ExistBaoTou(cards []byte, ch, ps, ks []uint32, wildcard byte, card byte, draw bool, ...) int64
- func ExistCaiShen(cards []byte, hu int64, wildcard byte, card byte, draw bool) int64
- func ExistHu(cards []byte, ch, ps, ks []uint32, wildcard byte, card byte, color int64, ...) int64
- func ExistLuanFeng(cards []byte) int64
- func ExistNCaiNKe(cs []byte, ch, ps, ks []uint32, wildcard byte, luanfeng int64) int64
- func ExistOneSuit(cards []byte, wildcard byte) int64
- func ExistPengPeng(cs []byte, wildcard byte) int64
- func GetHandPongKong(cards []byte, ch, ps, ks []uint32, wildcard byte) []byte
- func HuType(value int64, ante uint32) uint32
- func Legal(card byte) bool
- func NextSeat(seat uint32) uint32
- func Remove(c byte, cs []byte) []byte
- func RemoveN(c byte, cs []byte, n int) []byte
- func SearchDirtyCard(cs []byte, wildcard byte) byte
- func Sort(arr []byte, start, end int)
- func ThreeWildcard(handcard []byte, wildcard byte) int64
- func VerifyChow(cards []byte, c1, c2, c3 byte, wildcard byte) bool
Constants ¶
View Source
const ( WILDCARD byte = 255 // 万能牌(财神牌) BAI byte = 0x53 // 白板 TOTAL uint32 = 136 //一副麻将的总数 FENG byte = 4 //风牌类型 ZI byte = 5 //字牌类型 HAND uint32 = 13 //手牌数量 // 吃、碰、杠、胡掩码,用无符号32位每个二进制位代表不同的操作状态 PENG int64 = 2 << 0 // 碰 MING_KONG int64 = 2 << 1 // 明杠 AN_KONG int64 = 2 << 2 // 暗杠 BU_KONG int64 = 2 << 3 // 补杠 KONG int64 = 2 << 4 // 杠(代表广义的杠) CHOW int64 = 2 << 5 // 吃 HU int64 = 2 << 6 // 鸡胡(也代表广义的胡) HU_BAO_TOU1 int64 = 2 << 7 // 爆头(敲响,摸到普通牌),已经有十二张牌顺刻组合,剩下一张牌为财神,并无将牌,抓到任意一张则为敲响。普通牌2倍, HU_BAO_TOU2 int64 = 2 << 8 // 爆头(敲响,摸到摸到白板),已经有十二张牌顺刻组合,剩下一张牌为财神,并无将牌,抓到任意一张则为敲响。摸到白板4倍 HU_BAO_TOU3 int64 = 2 << 9 // 爆头(敲响,摸到财神),已经有十二张牌顺刻组合,剩下一张牌为财神,并无将牌,抓到任意一张则为敲响。摸到财神6倍 HU_LUAN_FENG int64 = 2 << 11 // 乱风,手牌都由风字牌组成,无需胡牌牌型 HU_QING_FENG int64 = 2 << 30 // 清风,手牌都由风字牌组成,需胡牌牌型 HU_QUAN_QIU_REN int64 = 2 << 13 // 全求人(单吊) ZIMO int64 = 2 << 17 // 自摸 PAOHU int64 = 2 << 18 // 炮胡,也叫放充 QIANG_GANG int64 = 2 << 19 // 抢杠,其他家胡你补杠那张牌 HU_KONG_FLOWER int64 = 2 << 20 // 杠上开花,杠完牌抓到的第一张牌自摸了 HU_HAI_LAO int64 = 2 << 21 // 海底捞月,每杠一次牌要从牌墙中除去8张牌,所以有杠牌的情况没有海底捞 TIAN_HU int64 = 2 << 23 // 天胡 DI_HU int64 = 2 << 24 // 地胡 HU_SINGLE int64 = 2 << 25 // 13不靠(风未齐) HU_SINGLE_ZI int64 = 2 << 26 // 13不靠 HU_CAI_1 int64 = 2 << 27 // 一财一刻,1个财神加2个白板组成一副刻子,2倍 HU_CAI_2 int64 = 2 << 28 // 两财一刻,2个财神加1个白板组成一副刻子,4倍 HU_CAI_3 int64 = 2 << 29 // 三财一刻,3个财神组成一副刻子,6倍 HU_GUI_WEI1 int64 = 2 << 14 // 一个财神归位,1个财神扮演其本身牌,2倍 HU_GUI_WEI2 int64 = 2 << 15 // 两个财神归位,2个财神扮演其本身牌,4倍 HU_GUI_WEI3 int64 = 2 << 16 // 三个财神归位,3个财神扮演其本身牌,6倍 HU_3_CAI_SHEN int64 = 2 << 22 // 三个财神额外加1倍 HU_SEVEN_PAIR int64 = 2 << 31 // 小七对(无财神) HU_SEVEN_PAIR_CAI int64 = 2 << 32 // 小七对(有财神) HU_ONE_SUIT int64 = 2 << 33 // 清一色(无财神) HU_ONE_SUIT_CAI int64 = 2 << 34 // 清一色(有财神) HU_PENG_PENG int64 = 2 << 35 // 碰碰胡(无财神) HU_PENG_PENG_CAI int64 = 2 << 36 // 碰碰胡(有财神) )
胡牌方式:自摸,放冲,枪杠胡,杠上开花,天胡,地胡等 胡牌牌型:平胡,碰碰胡,小七对,清一色,13不靠,财神归位等 牌墙只剩4张牌的情况下,如果有人放炮,放炮家要负责其他两家的分值 放炮胡时闲家的付出为放炮家的一半 牌型番值叠加最高不超过番
Variables ¶
View Source
var CARDS = []byte{}/* 136 elements not displayed */
全部牌值, 高四位表示色值(0:万,1:条,2:饼,4:风,5:字), 低四位表示1-9的牌值
View Source
var Fan = map[int64]uint32{ HU: 1, HU_BAO_TOU1: 2, HU_BAO_TOU2: 4, HU_BAO_TOU3: 6, HU_PENG_PENG: 4, HU_PENG_PENG_CAI: 2, HU_SEVEN_PAIR: 4, HU_SEVEN_PAIR_CAI: 2, HU_LUAN_FENG: 6, HU_QING_FENG: 6, HU_CAI_1: 2, HU_CAI_2: 4, HU_CAI_3: 6, HU_GUI_WEI1: 2, HU_GUI_WEI2: 4, HU_GUI_WEI3: 6, HU_3_CAI_SHEN: 2, TIAN_HU: 2, DI_HU: 2, HU_SINGLE: 1, HU_SINGLE_ZI: 2, HU_QUAN_QIU_REN: 4, HU_ONE_SUIT: 4, HU_ONE_SUIT_CAI: 2, QIANG_GANG: 2, HU_KONG_FLOWER: 2, HU_HAI_LAO: 2, }
Functions ¶
func DecodeChow ¶
func DecodeChow2 ¶
func DecodePeng ¶
func DiscardChow ¶
打牌检测,吃
func EncodeChow ¶
func ExistBaoTou ¶
func ExistBaoTou(cards []byte, ch, ps, ks []uint32, wildcard byte, card byte, draw bool, hu int64) int64
爆头检测(敲响): 已经有十二张牌组合好,剩下一张牌为财神,并无将牌,抓到任意一张则为敲响。普通牌2倍,摸到白板4倍,摸到财神6倍。 (已经有十二张牌组合好,剩下一张牌为财神,并无将牌,别人打出财神牌,或者白板算放炮吗) (此种情况为爆头,只能自摸,别人打出牌一律不能胡) (该种情况可与其他胡牌情况倍数累加)
func ExistCaiShen ¶
清一色/碰碰和/小七对 牌型有无财神对 检测
func ExistHu ¶
func ExistHu(cards []byte, ch, ps, ks []uint32, wildcard byte, card byte, color int64, luanfeng int64) int64
判断是否胡牌,0表示不胡牌,非0用32位表示不同的胡牌牌型
func ExistNCaiNKe ¶
func GetHandPongKong ¶
合并手牌、杠牌、碰牌
func SearchDirtyCard ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.