robots

package
v0.0.0-...-7f16e2a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySettings

func ApplySettings(req *proto_game.Server, settings *proto_game.Settings) *proto_game.Client

func Center

func Center(c *Caller, req *proto_game.Server, res *proto_game.Client) bool

func DefaultSettings

func DefaultSettings() *proto_game.Settings

func Kan

func Kan(c *Caller, req *proto_game.Server, res *proto_game.Client) bool

func Left

func Left(c *Caller, req *proto_game.Server, res *proto_game.Client) bool

func NoCenter

func NoCenter(s *proto_game.Suggest)

func NoChi

func NoChi(s *proto_game.Suggest)

func NoKan

func NoKan(s *proto_game.Suggest)

func NoLeft

func NoLeft(s *proto_game.Suggest)

func NoPon

func NoPon(s *proto_game.Suggest)

func NoRight

func NoRight(s *proto_game.Suggest)

func Pon

func Pon(c *Caller, req *proto_game.Server, res *proto_game.Client) bool
func Right(c *Caller, req *proto_game.Server, res *proto_game.Client) bool

func Run

func Run(ctx context.Context, conn *grpc.ClientConn, token string, robot Robot) error

Types

type CallFunc

type CallFunc func(*Caller, *proto_game.Server, *proto_game.Client) bool

type Caller

type Caller struct {
	Tracker
	Sequence []CallFunc
}

func NewCaller

func NewCaller(s ...CallFunc) *Caller

func (*Caller) Request

func (c *Caller) Request(req *proto_game.Server) *proto_game.Client

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn *grpc.ClientConn, robot Robot) *Client

func (*Client) Run

func (c *Client) Run(ctx context.Context, token string) error

type DebugDecorator

type DebugDecorator struct {
	// contains filtered or unexported fields
}

func NewDebugDecorator

func NewDebugDecorator(robot Robot, f func(*proto_game.Server, *proto_game.Client)) *DebugDecorator

func (*DebugDecorator) Request

func (d *DebugDecorator) Request(req *proto_game.Server) *proto_game.Client

type Effective

type Effective struct {
	Tracker
}

Effective is a robot, that uses uke-ire to build its hand. Declares riichi when ready. Note, that this robot does not know how to win. See SettingsDecorator.

func NewEffective

func NewEffective() *Effective

func (*Effective) Request

func (t *Effective) Request(req *proto_game.Server) *proto_game.Client

type Robot

type Robot interface {
	Request(*proto_game.Server) *proto_game.Client
}

type Settings

type Settings struct {
	proto_game.Settings
	Remove []SuggestFunc
}

type SettingsDecorator

type SettingsDecorator struct {
	Robot
	Settings Settings
}

SettingsDecorator is a decorator, that could accept wins. Also could protect other implementations from making particular calls.

func NewSettingsDecorator

func NewSettingsDecorator(c Robot, f ...SuggestFunc) *SettingsDecorator

func (*SettingsDecorator) Request

func (*SettingsDecorator) Update

func (d *SettingsDecorator) Update(x *proto_game.Settings)

type SuggestFunc

type SuggestFunc func(*proto_game.Suggest)

type Tracker

type Tracker struct {
	Tsumo
	ClientIndex int64
	Visible     compact.Instances
	Melds       []*proto_base.Meld
	Hand        compact.Instances
}

Tracker is a robot, tracking the hand state State is reset on a new round Use this robot as a helper struct, to implement others. Do not forget to pass every request to Tracker.

func NewTracker

func NewTracker() Tracker

func (*Tracker) Request

func (t *Tracker) Request(req *proto_game.Server) *proto_game.Client

type Tsumo

type Tsumo struct {
}

Tsumo is a Simple robot, rejecting all incomming suggest This should be a terminal decider of any robot

func (*Tsumo) Request

func (t *Tsumo) Request(req *proto_game.Server) *proto_game.Client

type Zaichik

type Zaichik struct {
	Robot
}

Zaichik is a robot, that is gready to declare kans

func (*Zaichik) Request

func (z *Zaichik) Request(req *proto_game.Server) *proto_game.Client

Jump to

Keyboard shortcuts

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