Documentation
¶
Overview ¶
Package automatic contains all the logic for the actual gameplay of Crossword Game, which, as we said before, features all sorts of things like wingos and blonks.
Index ¶
- Variables
- func AnalyzeLogFile(filepath string) (string, error)
- func ExportGCG(cfg *config.Config, filename, letterdist, lexicon, boardlayout, gid string, ...) error
- func GenerateSeeds(n int) ([][32]byte, error)
- func LoadSeeds(path string) ([][32]byte, error)
- func SaveSeeds(seeds [][32]byte, path string) error
- func StartCompVCompStaticGames(ctx context.Context, cfg *config.Config, numGames int, block bool, threads int, ...) error
- type AutomaticRunnerPlayer
- type DeterministicConfig
- type GameRunner
- func (r *GameRunner) CompVsCompStatic(addToHistory bool) error
- func (r *GameRunner) Game() *game.Game
- func (r *GameRunner) Init(players []AutomaticRunnerPlayer) error
- func (r *GameRunner) PlayBestTurn(playerIdx int, addToHistory bool) error
- func (r *GameRunner) StartGame(gidx int)
- func (r *GameRunner) StartGameWithSeed(gidx int, seed [32]byte)
- type Job
Constants ¶
This section is empty.
Variables ¶
var ( CVCCounter *expvar.Int IsPlaying *expvar.Int )
var MaxTimePerEndgame = 15 * time.Second
var MaxTimePerTurn = 30 * time.Second
Functions ¶
func AnalyzeLogFile ¶ added in v0.4.2
AnalyzeLogFile analyzes the given game CSV file and spits out a bunch of statistics.
func GenerateSeeds ¶ added in v0.11.8
GenerateSeeds creates n random 32-byte seeds for deterministic game runs
Types ¶
type AutomaticRunnerPlayer ¶ added in v0.5.0
type DeterministicConfig ¶ added in v0.11.8
type DeterministicConfig struct {
Seeds [][32]byte // Pre-generated seeds (nil = generate new)
SeedFile string // File to read/write seeds
NumGames int // Number of games (used when generating seeds)
}
DeterministicConfig holds configuration for deterministic autoplay runs
type GameRunner ¶
type GameRunner struct {
// contains filtered or unexported fields
}
GameRunner is the master struct here for the automatic game logic.
func NewGameRunner ¶ added in v0.4.2
func NewGameRunner(logchan chan string, cfg *config.Config) *GameRunner
NewGameRunner just instantiates and initializes a game runner.
func (*GameRunner) CompVsCompStatic ¶
func (r *GameRunner) CompVsCompStatic(addToHistory bool) error
CompVsCompStatic plays out a game to the end using best static turns.
func (*GameRunner) Game ¶ added in v0.4.5
func (r *GameRunner) Game() *game.Game
func (*GameRunner) Init ¶
func (r *GameRunner) Init(players []AutomaticRunnerPlayer) error
Init initializes the runner
func (*GameRunner) PlayBestTurn ¶ added in v0.5.0
func (r *GameRunner) PlayBestTurn(playerIdx int, addToHistory bool) error
PlayBestTurn generates the best move for the player and plays it on the board.
func (*GameRunner) StartGame ¶
func (r *GameRunner) StartGame(gidx int)
func (*GameRunner) StartGameWithSeed ¶ added in v0.11.8
func (r *GameRunner) StartGameWithSeed(gidx int, seed [32]byte)