Documentation
¶
Index ¶
- func EnsureKWG(lexname string, cfg *wglconfig.Config) error
- func ParseChallengeRule(rule string) (pb.ChallengeRule, error)
- func ShowChallengeRule(rule pb.ChallengeRule) string
- type BaseTurnPlayer
- func (p *BaseTurnPlayer) IsPlaying() bool
- func (p *BaseTurnPlayer) MoveFromEvent(evt *pb.GameEvent) (*move.Move, error)
- func (p *BaseTurnPlayer) NewChallengeMove(playerid int) (*move.Move, error)
- func (p *BaseTurnPlayer) NewExchangeMove(playerid int, letters string) (*move.Move, error)
- func (p *BaseTurnPlayer) NewPassMove(playerid int) (*move.Move, error)
- func (p *BaseTurnPlayer) NewPlacementMove(playerid int, coords string, word string, transpose bool) (*move.Move, error)
- func (p *BaseTurnPlayer) ParseMove(playerid int, lowercase bool, fields []string, transpose bool) (*move.Move, error)
- func (p *BaseTurnPlayer) SetCurrentRack(letters string) error
- func (p *BaseTurnPlayer) SetGame(g *game.Game)
- func (p *BaseTurnPlayer) SetPlayerRack(playerid int, letters string) error
- type GameOptions
- func (opts *GameOptions) SetBoardLayoutName(name string) error
- func (opts *GameOptions) SetChallenge(rule string) error
- func (opts *GameOptions) SetDefaults(cfg *config.Config)
- func (opts *GameOptions) SetLexicon(fields []string, cfg *wglconfig.Config) error
- func (opts *GameOptions) SetVariant(name string) error
- type Lexicon
- type TurnPlayer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureKWG ¶ added in v0.13.0
EnsureKWG checks whether the KWG file for lexname is present and, if not, downloads it from the woogles-io/liwords repository. It is safe to call before any code that calls kwg.GetKWG so that load paths other than "set lexicon" also get the file-not-found download behaviour.
func ParseChallengeRule ¶
func ParseChallengeRule(rule string) (pb.ChallengeRule, error)
func ShowChallengeRule ¶
func ShowChallengeRule(rule pb.ChallengeRule) string
Types ¶
type BaseTurnPlayer ¶
func BaseTurnPlayerFromRules ¶
func BaseTurnPlayerFromRules(opts *GameOptions, players []*pb.PlayerInfo, rules *game.GameRules) (*BaseTurnPlayer, error)
BaseTurnPlayerFromRules is a good entry point
func (*BaseTurnPlayer) IsPlaying ¶
func (p *BaseTurnPlayer) IsPlaying() bool
func (*BaseTurnPlayer) MoveFromEvent ¶
func (*BaseTurnPlayer) NewChallengeMove ¶
func (p *BaseTurnPlayer) NewChallengeMove(playerid int) (*move.Move, error)
func (*BaseTurnPlayer) NewExchangeMove ¶
func (*BaseTurnPlayer) NewPassMove ¶
func (p *BaseTurnPlayer) NewPassMove(playerid int) (*move.Move, error)
func (*BaseTurnPlayer) NewPlacementMove ¶
func (*BaseTurnPlayer) SetCurrentRack ¶
func (p *BaseTurnPlayer) SetCurrentRack(letters string) error
func (*BaseTurnPlayer) SetGame ¶
func (p *BaseTurnPlayer) SetGame(g *game.Game)
func (*BaseTurnPlayer) SetPlayerRack ¶
func (p *BaseTurnPlayer) SetPlayerRack(playerid int, letters string) error
type GameOptions ¶
type GameOptions struct {
Lexicon *Lexicon
ChallengeRule pb.ChallengeRule
BoardLayoutName string
Variant game.Variant
}
func (*GameOptions) SetBoardLayoutName ¶
func (opts *GameOptions) SetBoardLayoutName(name string) error
func (*GameOptions) SetChallenge ¶
func (opts *GameOptions) SetChallenge(rule string) error
func (*GameOptions) SetDefaults ¶
func (opts *GameOptions) SetDefaults(cfg *config.Config)
func (*GameOptions) SetLexicon ¶
func (opts *GameOptions) SetLexicon(fields []string, cfg *wglconfig.Config) error
func (*GameOptions) SetVariant ¶
func (opts *GameOptions) SetVariant(name string) error
type Lexicon ¶
func (*Lexicon) ToDisplayString ¶
type TurnPlayer ¶
type TurnPlayer interface {
SetPlayerRack(playerid int, letters string) error
SetCurrentRack(letters string) error
NewPlacementMove(playerid int, coords string, word string) (*move.Move, error)
NewPassMove(playerid int) (*move.Move, error)
NewChallengeMove(playerid int) (*move.Move, error)
NewExchangeMove(playerid int, letters string) (*move.Move, error)
MoveFromEvent(evt *pb.GameEvent) (*move.Move, error)
IsPlaying() bool
ParseMove(playerid int, lowercase bool, fields []string) (*move.Move, error)
AssignEquity(plays []*move.Move, oppRack *tilemapping.Rack)
}
TurnPlayer encapsulates all the functions needed to play a single turn of our crossword board game.
Click to show internal directories.
Click to hide internal directories.