func (cfg Config) NewGame(log log.Logger, id game.ID, WordValidator WordValidator, userDao UserDao) (*Game, error) {
	if err := cfg.validate(log, id, WordValidator, userDao); err != nil {
		return nil, fmt.Errorf("creating game: validation: %w", err)
	}
	g := Game{
		log:           log,
		id:            id,
		createdAt:     cfg.TimeFunc(),
		status:        game.NotStarted,
		players:       make(map[player.Name]*playerController.Player),
		WordValidator: WordValidator,
		userDao:       userDao,
		Config:        cfg,
	}
	if err := g.initializeUnusedTiles(); err != nil {
		return nil, err
	}
	return &g, nil
}
// NewGame creates a new game and runs it.
NewGame creates a new game and runs it.
// NewGame creates a new game and runs it .
func (cfg Config) NewGame(log log.Logger, id game.ID, WordValidator WordValidator, userDao UserDao) (*Game, error) {
	if err := cfg.validate(log, id, WordValidator, userDao); err != nil {
		return nil, fmt.Errorf("creating game: validation: %w", err)
	}
	g := Game{
		log:           log,
		id:            id,
		createdAt:     cfg.TimeFunc(),
		status:        game.NotStarted,
		players:       make(map[player.Name]*playerController.Player),
		WordValidator: WordValidator,
		userDao:       userDao,
		Config:        cfg,
	}
	if err := g.initializeUnusedTiles(); err != nil {
		return nil, err
	}
	return &g, nil
}
func ( cfg Config ) NewGame ( log log . Logger , id game . ID , WordValidator WordValidator , userDao UserDao ) ( * Game , error ) { if err := cfg . validate ( log , id , WordValidator , userDao ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } g := Game { log : log , id : id , createdAt : cfg . TimeFunc ( ) , status : game . NotStarted , players : make ( map [ player . Name ] * playerController . Player ) , WordValidator : WordValidator , userDao : userDao , Config : cfg , } if err := g . initializeUnusedTiles ( ) ; err != nil { return nil , err } return & g , nil }
NewGame creates a new game and runs it.
NewGame creates a new game and runs it .