yaku

package
v0.0.0-...-47e1d7f Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 9 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CompactYakuPref = &YakuPrefs{MergeDragons: true, MergeWinds: MergeWindToYakuhai, MergeDora: true}
View Source
var CompactYakuPref2 = &YakuPrefs{MergeDragons: true, MergeWinds: MergeWindToTile, MergeDora: true}
View Source
var CompactYakuPref3 = &YakuPrefs{MergeDragons: true, MergeWinds: MergeWindToType, MergeDora: true}
View Source
var DefaultYakuPref = &YakuPrefs{}

Functions

func IndicatorsToDoraTiles

func IndicatorsToDoraTiles(in tile.Instances) tile.Tiles

func TileIndicatorsToDoraTiles

func TileIndicatorsToDoraTiles(in tile.Tiles) tile.Tiles

Types

type Context

type Context struct {
	Tile        tile.Instance
	SelfWind    base.Wind
	RoundWind   base.Wind
	DoraTiles   tile.Tiles
	UraTiles    tile.Tiles
	Rules       Rules
	IsTsumo     bool
	IsRiichi    bool
	IsIpatsu    bool
	IsDaburi    bool
	IsLastTile  bool
	IsRinshan   bool
	IsFirstTake bool
	IsChankan   bool
}

Context is createed to avoid using other game objects in calculations

type Dictionary

type Dictionary map[string]string

func AppendResources16

func AppendResources16(in Dictionary, str string, indexes []uint16) Dictionary

func AppendResources8

func AppendResources8(in Dictionary, str string, indexes []uint8) Dictionary

func GetResources

func GetResources() Dictionary

type Fu

type Fu int
const (
	FuNone Fu = iota
	FuBase
	FuBaseClosedRon
	FuBase7
	FuSet
	FuTsumo
	FuMeld
	FuNoOpenFu
	FuBadWait
	FuPair
)

func (Fu) String

func (i Fu) String() string

type FuInfo

type FuInfo struct {
	Fu     Fu
	Points FuPoints
	Meld   calc.Meld
}

type FuPoints

type FuPoints int

func GetMeldFu

func GetMeldFu(m calc.Meld) FuPoints

func (FuPoints) Round

func (p FuPoints) Round() FuPointsRounded

type FuPointsRounded

type FuPointsRounded int

type Fus

type Fus []*FuInfo

func (Fus) String

func (f Fus) String() string

func (Fus) Sum

func (f Fus) Sum() FuPoints

type HanPoints

type HanPoints int

type Limit

type Limit int
const (
	LimitNone      Limit = 0
	LimitMangan    Limit = 1
	LimitHaneman   Limit = 2
	LimitBaiman    Limit = 3
	LimitSanbaiman Limit = 4
	LimitYakuman   Limit = 5
)

Limit numbers are now fixed and should not be changed

func (Limit) BaseHans

func (lim Limit) BaseHans() HanPoints

func (Limit) ShortString

func (lim Limit) ShortString() string

func (Limit) String

func (i Limit) String() string

type Result

type Result struct {
	Yaku     YakuSet
	Yakumans Yakumans
	Bonuses  YakuSet
	Fus      Fus

	IsClosed bool
}

func Win

func Win(results *tempai.TempaiResults, ctx *Context, declaredTiles compact.Instances) *Result

func (*Result) String

func (r *Result) String() string

func (*Result) Sum

func (r *Result) Sum() HanPoints

type Rules

type Rules interface {
	OpenTanyao() bool
	CheckAka(i tile.Instance) bool
	Renhou() Limit
	HaiteiFromLiveOnly() bool
	Ura() bool
	Ipatsu() bool
	GreenRequired() bool
	RinshanFu() bool
}

type RulesStruct

type RulesStruct struct {
	IsOpenTanyao         bool
	AkaDoras             []tile.Instance
	RenhouLimit          Limit
	IsHaiteiFromLiveOnly bool
	IsUra                bool
	IsIpatsu             bool
	IsGreenRequired      bool
	IsRinshanFu          bool
}

func RulesEMA

func RulesEMA() *RulesStruct

func RulesJPMPLA

func RulesJPMPLA() *RulesStruct

func RulesJPMPLB

func RulesJPMPLB() *RulesStruct

func RulesTenhouRed

func RulesTenhouRed() *RulesStruct

func (*RulesStruct) CheckAka

func (r *RulesStruct) CheckAka(i tile.Instance) bool

func (*RulesStruct) GreenRequired

func (r *RulesStruct) GreenRequired() bool

func (*RulesStruct) HaiteiFromLiveOnly

func (r *RulesStruct) HaiteiFromLiveOnly() bool

func (*RulesStruct) Ipatsu

func (r *RulesStruct) Ipatsu() bool

func (*RulesStruct) OpenTanyao

func (r *RulesStruct) OpenTanyao() bool

func (*RulesStruct) Renhou

func (r *RulesStruct) Renhou() Limit

func (*RulesStruct) RinshanFu

func (r *RulesStruct) RinshanFu() bool

func (*RulesStruct) Ura

func (r *RulesStruct) Ura() bool

type WindMergeType

type WindMergeType int
const (
	MergeWindNoMerge WindMergeType = iota
	MergeWindToYakuhai
	MergeWindToTile
	MergeWindToType // Self/Round
)

type Yaku

type Yaku int
const (
	YakuNone           Yaku = 0
	YakuRiichi         Yaku = 1
	YakuDaburi         Yaku = 2
	YakuIppatsu        Yaku = 3
	YakuTsumo          Yaku = 4
	YakuTanyao         Yaku = 5
	YakuChanta         Yaku = 6
	YakuJunchan        Yaku = 7
	YakuHonrouto       Yaku = 8
	YakuYakuhai        Yaku = 9
	YakuHaku           Yaku = 10
	YakuHatsu          Yaku = 11
	YakuChun           Yaku = 12
	YakuWindRound      Yaku = 13
	YakuWindSelf       Yaku = 14
	YakuTon            Yaku = 15
	YakuNan            Yaku = 16
	YakuSja            Yaku = 17
	YakuPei            Yaku = 18
	YakuTonSelf        Yaku = 19
	YakuNanSelf        Yaku = 20
	YakuSjaSelf        Yaku = 21
	YakuPeiSelf        Yaku = 22
	YakuTonRound       Yaku = 23
	YakuNanRound       Yaku = 24
	YakuSjaRound       Yaku = 25
	YakuPeiRound       Yaku = 26
	YakuChiitoi        Yaku = 27
	YakuToitoi         Yaku = 28
	YakuSanankou       Yaku = 29
	YakuSankantsu      Yaku = 30
	YakuSanshoku       Yaku = 31
	YakuShousangen     Yaku = 32
	YakuPinfu          Yaku = 33
	YakuIppeiko        Yaku = 34
	YakuRyanpeikou     Yaku = 35
	YakuItsuu          Yaku = 36
	YakuSanshokuDoukou Yaku = 37
	YakuHonitsu        Yaku = 38
	YakuChinitsu       Yaku = 39
	YakuDora           Yaku = 40
	YakuUraDora        Yaku = 41
	YakuAkaDora        Yaku = 42
	YakuRenhou         Yaku = 43
	YakuHaitei         Yaku = 44
	YakuHoutei         Yaku = 45
	YakuRinshan        Yaku = 46
	YakuChankan        Yaku = 47
)

Yaku numbers are now fixed and should not be changed

func (Yaku) String

func (i Yaku) String() string

type YakuPrefs

type YakuPrefs struct {
	MergeDragons   bool
	MergeWinds     WindMergeType
	MergeWindRound bool
	MergeDora      bool
}

func (*YakuPrefs) FormatYaku

func (p *YakuPrefs) FormatYaku(in YakuSet) YakuSet

type YakuSet

type YakuSet map[Yaku]HanPoints

func (YakuSet) String

func (y YakuSet) String() string

func (YakuSet) Sum

func (y YakuSet) Sum() HanPoints

type Yakuman

type Yakuman int
const (
	YakumanNone          Yakuman = 0
	YakumanKokushi       Yakuman = 1
	YakumanKokushi13     Yakuman = 2
	YakumanSuukantsu     Yakuman = 3
	YakumanSuuankou      Yakuman = 4
	YakumanSuuankouTanki Yakuman = 5
	YakumanDaisangen     Yakuman = 6
	YakumanShousuushi    Yakuman = 7
	YakumanDaisuushi     Yakuman = 8
	YakumanRyuuiisou     Yakuman = 9
	YakumanTsuiisou      Yakuman = 10
	YakumanChinrouto     Yakuman = 11
	YakumanChuurenpooto  Yakuman = 12
	YakumanChuurenpooto9 Yakuman = 13
	YakumanTenhou        Yakuman = 14
	YakumanChihou        Yakuman = 15
	YakumanRenhou        Yakuman = 16
)

Yakuman numbers are now fixed and should not be changed

func (Yakuman) String

func (i Yakuman) String() string

type Yakumans

type Yakumans []Yakuman

func (Yakumans) String

func (y Yakumans) String() string

Jump to

Keyboard shortcuts

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