rule

package
v0.0.0-...-c5f9841 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

https://www.xqbase.com/other/mahjongg_english.htm

Index

Constants

View Source
const (
	PingHu   = iota
	PongPong // 碰碰胡:由4副刻子(或杠)、将牌组成的胡牌
	QiDui    // 七对: 7个对子组成的的胡牌
	LongQiDui
	ShuangLongQiDui
	HaoHuaLongQiDui
	QYS          // 清一色:由一种花色的牌组成的胡牌
	HaiDiLao     // 海底捞:抓棹面上最后一张牌的人正好能胡牌
	GangShangHua // 杠上花: 杠来自己要胡的牌胡牌
)

Variables

This section is empty.

Functions

func CanHu

func CanHu(onHand mahjong.Indexes, discard int) bool

func CanZimo

func CanZimo(onHand mahjong.Indexes) bool

func EnableDebug

func EnableDebug(enable bool)

func Group

func Group(input []int) [][]int

func IsLegal

func IsLegal(onHand []int) bool

func IsTing

func IsTing(onHand mahjong.Indexes) bool

func IsWin

func IsWin(mj mahjong.Indexes) bool

是否和牌

func IsWinWithIndexes

func IsWinWithIndexes(indexes mahjong.Indexes) bool

func Shrink

func Shrink(in []int) ([]int, bool)

Shrink 剪枝

func Stats

func Stats(indexes ...mahjong.Indexes) *mahjong.Stats

func TingTiles

func TingTiles(onHand mahjong.Indexes) mahjong.Indexes

传入一副牌,返回所有的听牌

Types

type Base

type Base struct{}

func NewBase

func NewBase() *Base

func (Base) MaxMultiple

func (b Base) MaxMultiple(opts *protocol.DeskOptions, onHand, pongKong mahjong.Indexes) (multiple int, index int)

返回听牌最大番数

func (Base) Multiple

func (b Base) Multiple(ctx *mahjong.Context, onHand, pongKong mahjong.Indexes) int

返回番数

type Scorer

type Scorer interface {
	Multiple(ctx *mahjong.Context, onHand, pongKong mahjong.Indexes) int                               //算分数
	MaxMultiple(opts *protocol.DeskOptions, onHand, pongKong mahjong.Indexes) (mutiple int, index int) //最大番数
}

func Rule

func Rule() Scorer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL