Documentation ¶
Overview ¶
Package player is an automatic player of Crossword Game, using various forms of AI.
Index ¶
- Constants
- func GenBestStaticTurn(game *game.Game, movegen movegen.MoveGenerator, aiplayer AIPlayer, ...) *move.Move
- type AIPlayer
- type RawEquityPlayer
- func (p *RawEquityPlayer) AssignEquity(moves []*move.Move, board *board.GameBoard, bag *alphabet.Bag, ...)
- func (p *RawEquityPlayer) BestPlay(moves []*move.Move) *move.Move
- func (p *RawEquityPlayer) GetBotType() pb.BotRequest_BotCode
- func (p *RawEquityPlayer) Strategizer() strategy.Strategizer
- func (p *RawEquityPlayer) TopPlays(moves []*move.Move, n int) []*move.Move
Constants ¶
View Source
const (
// Infinity is a shockingly large number.
Infinity = 10000000.0
)
Variables ¶
This section is empty.
Functions ¶
func GenBestStaticTurn ¶
func GenBestStaticTurn(game *game.Game, movegen movegen.MoveGenerator, aiplayer AIPlayer, playerIdx int) *move.Move
GenBestStaticTurn is a useful utility function for sims and autoplaying.
Types ¶
type AIPlayer ¶
type AIPlayer interface { // AssignEquity will assign equities to the given moves. AssignEquity([]*move.Move, *board.GameBoard, *alphabet.Bag, *alphabet.Rack) // BestPlay picks the best play from the list of plays. BestPlay([]*move.Move) *move.Move // TopPlays picks the top N plays from the list of plays. TopPlays([]*move.Move, int) []*move.Move Strategizer() strategy.Strategizer GetBotType() pb.BotRequest_BotCode }
AIPlayer describes an artificial player. It uses a Strategizer to decide on moves to make.
type RawEquityPlayer ¶
type RawEquityPlayer struct {
// contains filtered or unexported fields
}
RawEquityPlayer plays by equity only and does no look-ahead / sim.
func NewRawEquityPlayer ¶
func NewRawEquityPlayer(s strategy.Strategizer, botType pb.BotRequest_BotCode) *RawEquityPlayer
func (*RawEquityPlayer) AssignEquity ¶
func (p *RawEquityPlayer) AssignEquity(moves []*move.Move, board *board.GameBoard, bag *alphabet.Bag, oppRack *alphabet.Rack)
AssignEquity uses the strategizer to assign an equity to every move. This is the sole module dedicated to assigning equities. (Perhaps it should be named something else?)
func (*RawEquityPlayer) BestPlay ¶
func (p *RawEquityPlayer) BestPlay(moves []*move.Move) *move.Move
BestPlay picks the highest equity play. It is assumed that these plays have already been assigned an equity but are not necessarily sorted.
func (*RawEquityPlayer) GetBotType ¶
func (p *RawEquityPlayer) GetBotType() pb.BotRequest_BotCode
func (*RawEquityPlayer) Strategizer ¶
func (p *RawEquityPlayer) Strategizer() strategy.Strategizer
Click to show internal directories.
Click to hide internal directories.