Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateAgariRate(waits Waits, selfDiscards []int) float64
- func CalculateShanten(tiles34 []int, isOpen bool) int
- func CalculateShantenWithImproves14(tiles34 []int, isOpen bool) (shanten int, waitsWithImproves WaitsWithImproves14List, ...)
- func CalculateShantenWithoutChitoitsu(tiles34 []int) int
- func CheckWin(tiles34 []int) bool
- func CountOfTiles(tiles []int) (count int)
- func CountPairs(tiles34 []int) (pairs int)
- func MustStrToTiles34(tiles string) []int
- func NumberToChineseShanten(num int) string
- func StrToTile34(tile string) (tile34 int, err error)
- func StrToTiles34(tiles string) (num int, tiles34 []int, err error)
- func Tiles34ToMergedStr(tiles34 []int) (res string)
- func Tiles34ToMergedStrWithBracket(tiles34 []int) (res string)
- func TilesToMergedStr(tiles []int) (res string)
- func TilesToMergedStrWithBracket(tiles []int) (res string)
- type Improves
- type Waits
- type WaitsWithImproves13
- type WaitsWithImproves14
- type WaitsWithImproves14List
- type WallSafeTile
- type WallSafeTileList
Constants ¶
View Source
const ( WallSafeTypeNC = iota WallSafeTypeOC_Double WallSafeTypeOC_Mix WallSafeTypeOC_Single )
View Source
const AgariState = -1
Variables ¶
View Source
var ( // [需要判断危险度的牌号(0-8)][是否有对应的现物(0-1或0-3)] // 123789: 无现物,有现物 // 4: 无17现物,无1有7,有1无7,有17 // 56: 同上 TileTypeTable = [][]tileType{ {tileTypeNoSuji19, tileTypeSuji19}, {tileTypeNoSuji28, tileTypeSuji28}, {tileTypeNoSuji37, tileTypeSuji37}, {tileTypeNoSuji46, tileTypeHalfSuji46B, tileTypeHalfSuji46A, tileTypeDoubleSuji46}, {tileTypeNoSuji5, tileTypeHalfSuji5, tileTypeHalfSuji5, tileTypeDoubleSuji5}, {tileTypeNoSuji46, tileTypeHalfSuji46A, tileTypeHalfSuji46B, tileTypeDoubleSuji46}, {tileTypeNoSuji37, tileTypeSuji37}, {tileTypeNoSuji28, tileTypeSuji28}, {tileTypeNoSuji19, tileTypeSuji19}, } // [是否为役牌(0-1)][剩余数-1] ZiTileType = [][]tileType{ {tileTypeOtaHaiLeft1, tileTypeOtaHaiLeft2, tileTypeOtaHaiLeft3, tileTypeOtaHaiLeft3}, {tileTypeYakuHaiLeft1, tileTypeYakuHaiLeft2, tileTypeYakuHaiLeft3, tileTypeOtaHaiLeft3}, } )
View Source
var RiskData = [][]float64{
{},
{5.7, 5.7, 5.8, 4.7, 3.4, 2.5, 2.5, 3.1, 5.6, 3.8, 1.8, -1, -1, 2.1, 1.2, 0.5, 2.4, 1.4, 1.2},
{6.6, 6.9, 6.3, 5.2, 4.0, 3.5, 3.5, 4.1, 5.3, 3.5, 1.9, 0.8, 2.6, 2.3, 1.2, 0.5, 2.7, 1.3, 0.4},
{7.7, 8.0, 6.7, 5.8, 4.6, 4.3, 4.1, 4.9, 5.2, 3.6, 1.8, 1.6, 2.0, 2.4, 1.2, 0.3, 2.6, 1.2, 0.3},
{8.5, 8.9, 7.1, 6.2, 5.1, 4.8, 4.7, 5.6, 5.2, 3.8, 1.7, 1.6, 2.0, 2.6, 1.1, 0.2, 2.6, 1.2, 0.2},
{9.4, 9.7, 7.5, 6.7, 5.5, 5.3, 5.1, 6.0, 5.3, 3.7, 1.7, 1.7, 2.0, 2.9, 1.2, 0.2, 2.8, 1.2, 0.2},
{10.2, 10.5, 7.9, 7.1, 5.9, 5.8, 5.6, 6.4, 5.2, 3.7, 1.7, 1.8, 2.0, 3.2, 1.3, 0.2, 2.9, 1.3, 0.2},
{11.0, 11.3, 8.4, 7.5, 6.3, 6.3, 6.1, 6.8, 5.3, 3.7, 1.7, 2.0, 2.1, 3.6, 1.4, 0.2, 3.2, 1.4, 0.2},
{11.9, 12.2, 8.9, 8.0, 6.8, 6.9, 6.6, 7.4, 5.3, 3.8, 1.7, 2.1, 2.2, 4.0, 1.6, 0.2, 3.5, 1.6, 0.2},
{12.8, 13.1, 9.5, 8.6, 7.4, 7.4, 7.2, 7.9, 5.5, 3.9, 1.8, 2.2, 2.3, 4.6, 1.9, 0.3, 4.0, 1.8, 0.2},
{13.8, 14.1, 10.1, 9.2, 8.0, 8.0, 7.8, 8.5, 5.6, 4.0, 1.9, 2.4, 2.4, 5.3, 2.2, 0.3, 4.6, 2.1, 0.3},
{14.9, 15.1, 10.8, 9.9, 8.7, 8.7, 8.5, 9.2, 5.7, 4.2, 2.0, 2.5, 2.6, 6.0, 2.6, 0.4, 5.1, 2.5, 0.3},
{16.0, 16.3, 11.6, 10.6, 9.4, 9.4, 9.2, 9.9, 6.0, 4.4, 2.2, 2.7, 2.7, 6.8, 3.1, 0.4, 5.1, 2.5, 0.3},
{17.2, 17.5, 12.4, 11.4, 10.2, 10.2, 10.0, 10.6, 6.2, 4.6, 2.4, 3.0, 3.0, 7.8, 3.7, 0.5, 6.6, 3.7, 0.5},
{18.5, 18.8, 13.3, 12.3, 11.1, 11.0, 10.9, 11.4, 6.6, 4.9, 2.7, 3.2, 3.1, 8.8, 4.4, 0.7, 7.4, 4.4, 0.6},
{19.9, 20.1, 14.3, 13.3, 12.0, 11.9, 11.8, 12.3, 7.0, 5.3, 3.0, 3.4, 3.4, 9.9, 5.2, 0.8, 8.4, 5.3, 0.8},
{21.3, 21.7, 15.4, 14.3, 13.1, 12.9, 12.8, 13.3, 7.4, 5.7, 3.3, 3.7, 3.6, 11.2, 6.2, 1.0, 9.4, 6.5, 0.9},
{22.9, 23.2, 16.6, 15.4, 14.2, 14.0, 13.8, 14.4, 8.0, 6.1, 3.6, 3.9, 3.9, 12.4, 7.3, 1.3, 10.5, 7.7, 1.2},
{24.7, 24.9, 17.9, 16.7, 15.4, 15.2, 15.0, 15.6, 8.5, 6.6, 4.0, 4.3, 4.2, 13.9, 8.5, 1.7, 11.8, 9.4, 1.6},
{27.5, 27.8, 20.4, 19.1, 17.8, 17.5, 17.5, 17.5, 9.8, 7.4, 5.0, 5.1, 5.1, 18.1, 12.1, 2.8, 14.7, 12.6, 2.1},
}
[巡目][类型]
Functions ¶
func CalculateAgariRate ¶ added in v0.1.2
selfDiscards: 自家舍牌,用于分析骗筋时的和率
func CalculateShanten ¶
根据手牌计算向听数 tiles34 手牌 isOpen 是否副露,未副露的手牌会考虑七对子
func CalculateShantenWithImproves14 ¶
func CalculateShantenWithImproves14(tiles34 []int, isOpen bool) (shanten int, waitsWithImproves WaitsWithImproves14List, incShantenResults WaitsWithImproves14List)
2/5/8/11/14 张牌,计算向听数、进张、改良、向听倒退等
func CheckWin ¶ added in v0.1.2
14张牌,检查是否和牌
「1」 →「0」 「2」 →「110」 「3」 →「11110」 「4」 →「1111110」 「10」→「10」 「20」→「1110」 「30」→「111110」 「40」→「11111110」
func CountOfTiles ¶
func CountPairs ¶
func MustStrToTiles34 ¶
func NumberToChineseShanten ¶
func StrToTile34 ¶
func StrToTiles34 ¶
e.g. "22m 24p" => (4, [0, 2, 0, 0, ...,0, 10, 12])
func Tiles34ToMergedStr ¶ added in v0.1.2
func Tiles34ToMergedStrWithBracket ¶ added in v0.1.2
func TilesToMergedStrWithBracket ¶
[0, 2, 9] => "[13m 1p]"
Types ¶
type Waits ¶
map[进张牌]剩余数
func CalculateShantenAndWaits13 ¶
1/4/7/10/13 张牌,计算向听数和进张
func (Waits) FixCountsWithLeftCounts ¶
func (Waits) ParseIndex ¶
type WaitsWithImproves13 ¶
type WaitsWithImproves13 struct { // 手牌 Tiles34 []int // 向听数 Shanten int // 进张:摸到这张牌可以让向听数前进 Waits Waits // map[进张牌]向听前进后的进张数(这里让向听前进的切牌是最优切牌,即让向听前进后的进张数最大的切牌) NextShantenWaitsCountMap map[int]int // 改良:摸到这张牌虽不能让向听数前进,但可以让进张变多 Improves Improves // 改良情况数 ImproveWayCount int // 对于每张牌,摸到之后的手牌进张数(如果摸到的是 Waits 中的牌,则进张数视作摸到之前的进张数) ImproveWaitsCount34 []int // 在没有摸到进张时的改良进张数的加权均值 AvgImproveWaitsCount float64 // 向听前进后的进张数的加权均值 AvgNextShantenWaitsCount float64 }
1/4/7/10/13 张手牌的分析结果
func CalculateShantenWithImproves13 ¶
func CalculateShantenWithImproves13(tiles34 []int, isOpen bool) (waitsWithImproves *WaitsWithImproves13)
1/4/7/10/13 张牌,计算向听数、进张、改良等
type WaitsWithImproves14 ¶
type WaitsWithImproves14 struct { Result13 *WaitsWithImproves13 // 需要切的牌 DiscardTile int // 切掉这张牌后的向听数 Shanten int }
func (*WaitsWithImproves14) String ¶
func (r *WaitsWithImproves14) String() string
type WaitsWithImproves14List ¶
type WaitsWithImproves14List []*WaitsWithImproves14
func (WaitsWithImproves14List) Sort ¶
func (l WaitsWithImproves14List) Sort()
type WallSafeTile ¶ added in v0.1.3
type WallSafeTileList ¶ added in v0.1.3
type WallSafeTileList []WallSafeTile
func CalcNCSafeTiles34 ¶ added in v0.1.3
func CalcNCSafeTiles34(leftTiles34 []int) (ncSafeTiles34 WallSafeTileList)
根据剩余牌 leftTiles34 中的某些牌是否为 0,来判断哪些牌较为安全(只输双碰、单骑、边张、坎张)
func CalcOCSafeTiles34 ¶ added in v0.1.3
func CalcOCSafeTiles34(leftTiles34 []int) (ocSafeTiles34 WallSafeTileList)
func CalcWallTiles34 ¶ added in v0.1.3
func CalcWallTiles34(leftTiles34 []int) (safeTiles34 WallSafeTileList)
func (WallSafeTileList) FilterWithHands ¶ added in v0.1.3
func (l WallSafeTileList) FilterWithHands(handsTiles34 []int) WallSafeTileList
Click to show internal directories.
Click to hide internal directories.