func (an *Analyzer) AnalyzeGame(q *Query) (*AnalysisList, error) {
	an.bootWait.Wait()
	json, err := q.ToJSON()
	if err != nil {
		return nil, err
	}
	jsonStr := string(json)
	if jsonStr[len(jsonStr)-1:] != "\n" {
		jsonStr = jsonStr + "\n"
	}
	an.analysisSizeMap.Store(q.ID, len(q.AnalyzeTurns))
	an.stdinWrite <- jsonStr
	analysis := an.readCollectedResult(q.ID)
	an.analysisSizeMap.Delete(q.ID)
	return analysis, nil
}
AnalyzeGame is a synchronous request for Katago to process a game
package katago
import (
	"bufio"
	"io"
	"os/exec"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/golang/glog"
)
const katagoReadyStr = "Started, ready to begin handling requests"
const collectorTimeout = 2 * time.Second
const maxCollectorTimeout = 30 * time.Second
type Analyzer struct {
	model string
	config string
	analysisThreads int
	cmd *exec.Cmd
	stdinQuit    chan int
	stdinWrite   chan string
	katagoOutput chan string
	collectorQuit          chan int
	analysisSizeMap        sync.Map
	outputResultCollection map[string]*AnalysisList
	outputResultCondition  *sync.Cond
	bootWait sync.WaitGroup
}
func New(model string, configPath string, analysisThreads int) *Analyzer {
	an := &Analyzer{
		model:                  model,
		config:                 configPath,
		analysisThreads:        analysisThreads,
		stdinQuit:              make(chan int),
		stdinWrite:             make(chan string),
		katagoOutput:           make(chan string),
		collectorQuit:          make(chan int),
		outputResultCollection: make(map[string]*AnalysisList),
		outputResultCondition:  sync.NewCond(&sync.Mutex{}),
	}
	an.cmd = an.createCmd()
	return an
}
func (an *Analyzer) Start() error {
	glog.Info("Starting Katago analyzer")
	glog.Infof("Using model %q", an.model)
	glog.Infof("Using gtp config %q", an.config)
	an.bootWait.Add(1)
	go an.resultCollector()
	err := an.startAnalyzerIO()
	if err != nil {
		return err
	}
	glog.V(2).Infof("Executing katago command: %v", an.cmd)
	err = an.cmd.Start()
	if err != nil {
		return err
	}
	an.bootWait.Wait()
	glog.Info("Katago Startup Complete")
	return nil
}