log

package
v0.0.0-...-bd21981 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogUrlPrefix = "http://tenhou.net/0/?log="
	XmlUrlPrefix = "https://tenhou.net/0/log/?"
)

Variables

This section is empty.

Functions

func DecodeLobby

func DecodeLobby(in string) (res tbase.LobbyRules, err error)

func ProcessXMLNode

func ProcessXMLNode(node *parser.Node, c Controller) (err error)

func ProcessXMLNodes

func ProcessXMLNodes(nodes parser.Nodes, c Controller) (err error)

Types

type AgariExtractor

type AgariExtractor struct {
	NullController
	Round     int
	Dealer    tbase.Opponent
	DoubleRon bool
	Info      *Info
	KanFlag   bool
	IsSanma   bool

	Callback func(*Info, *tbase.Agari, *yaku.Context, base.Wind, score.Rules)
	// contains filtered or unexported fields
}

func NewAgariExtractor

func NewAgariExtractor(x func(*Info, *tbase.Agari, *yaku.Context, base.Wind, score.Rules)) *AgariExtractor

func NewValidator

func NewValidator(err *error) *AgariExtractor

func (*AgariExtractor) Agari

func (e *AgariExtractor) Agari(agari tbase.Agari)

func (*AgariExtractor) Close

func (e *AgariExtractor) Close()

func (*AgariExtractor) Declare

func (e *AgariExtractor) Declare(params Declare)

func (*AgariExtractor) Discard

func (*AgariExtractor) Init

func (e *AgariExtractor) Init(params Init)

func (*AgariExtractor) Open

func (e *AgariExtractor) Open(info Info) bool

func (*AgariExtractor) UserList

func (e *AgariExtractor) UserList(params client.UserList)

type AgariReport

type AgariReport struct {
	Log            *string        `json:"id,omitempty"`
	Round          int            `json:"round"`
	Wind           int            `json:"wind"`
	Score          score.Money    `json:"score"`
	Tile           tile.Instance  `json:"tile"`
	Hand           tile.Instances `json:"hand"`
	Melds          tbase.Melds    `json:"melds,omitempty"`
	DoraIndicators tile.Instances `json:"dora-indicators"`
	UraIndicators  tile.Instances `json:"ura-indicators,omitempty"`
	Yaku           tbase.Yakus    `json:"yaku,omitempty"`
	Yakuman        tbase.Yakumans `json:"yakuman,omitempty"`
}

func ValidateAgari

func ValidateAgari(outError *error, info *Info, agari *tbase.Agari, ctx *yaku.Context, w base.Wind, scoring score.Rules) *AgariReport

type Controller

type Controller interface {
	// Should return false if not interested
	Open(Info) bool
	Close()

	Shuffle(Shuffle)
	Go(client.WithLobby)
	Start(client.WithDealer)
	Init(Init)
	Draw(WithOpponentAndInstance)
	Discard(WithOpponentAndInstance)
	Declare(Declare)
	Ryuukyoku(tbase.Ryuukyoku)
	Reach(client.Reach)
	Agari(tbase.Agari)
	Indicator(client.WithInstance)
	Disconnect(client.WithOpponent)

	client.UNController
}

type Declare

type Declare struct {
	client.WithOpponent
	Meld tbase.Meld
}

type Info

type Info struct {
	Time      time.Time
	Rules     tbase.LobbyRules
	Lobby     int
	Id        string
	FixedId   string
	FixedName string
	FullName  string
	LogUrl    string
	XmlUrl    string
}

func ParseLogInfo

func ParseLogInfo(fileName string) (ret *Info, err error)

2009061806gm-00a1-0000-6d13c207 /2009/03/17/2009031702gm

func (*Info) DebugString

func (i *Info) DebugString() string

type Init

type Init struct {
	tbase.Init
	Hands tbase.Hands
	// TODO: research
	Shuffle string
}

type NullController

type NullController struct{}

func (NullController) Agari

func (NullController) Agari(tbase.Agari)

func (NullController) Close

func (NullController) Close()

func (NullController) Declare

func (NullController) Declare(Declare)

func (NullController) Discard

func (NullController) Disconnect

func (NullController) Disconnect(client.WithOpponent)

func (NullController) Draw

func (NullController) Go

func (NullController) Indicator

func (NullController) Indicator(client.WithInstance)

func (NullController) Init

func (NullController) Init(Init)

func (NullController) Open

func (NullController) Open(Info) bool

func (NullController) Reach

func (NullController) Reach(client.Reach)

func (NullController) Reconnect

func (NullController) Reconnect(client.Reconnect)

func (NullController) Ryuukyoku

func (NullController) Ryuukyoku(tbase.Ryuukyoku)

func (NullController) Shuffle

func (NullController) Shuffle(Shuffle)

func (NullController) Start

func (NullController) UserList

func (NullController) UserList(client.UserList)

type Shuffle

type Shuffle struct {
	Seed string
	Ref  string
}

type WithOpponentAndInstance

type WithOpponentAndInstance struct {
	client.WithOpponent
	client.WithInstance
}

type XMLWriter

type XMLWriter struct {
	client.XMLWriter
}

func (*XMLWriter) Agari

func (w *XMLWriter) Agari(params tbase.Agari)

func (*XMLWriter) Close

func (w *XMLWriter) Close()

func (*XMLWriter) Declare

func (w *XMLWriter) Declare(params Declare)

func (*XMLWriter) Discard

func (w *XMLWriter) Discard(params WithOpponentAndInstance)

func (*XMLWriter) Disconnect

func (w *XMLWriter) Disconnect(params client.WithOpponent)

func (*XMLWriter) Draw

func (w *XMLWriter) Draw(params WithOpponentAndInstance)

func (*XMLWriter) Go

func (w *XMLWriter) Go(params client.WithLobby)

func (*XMLWriter) Init

func (w *XMLWriter) Init(params Init)

func (*XMLWriter) Open

func (w *XMLWriter) Open(Info) bool

func (*XMLWriter) Ryuukyoku

func (w *XMLWriter) Ryuukyoku(params tbase.Ryuukyoku)

func (*XMLWriter) Shuffle

func (w *XMLWriter) Shuffle(params Shuffle)

func (*XMLWriter) Start

func (w *XMLWriter) Start(params client.WithDealer)

func (XMLWriter) UserList

func (w XMLWriter) UserList(params client.UserList)

Jump to

Keyboard shortcuts

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