You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool-biz/ngochess/katago/resp.go

69 lines
3.2 KiB
Go

10 months ago
package katago
type BaseResp struct {
ID string `json:"id"` // ID 必有
Action string `json:"action,omitempty,optional"` // Action 动作,不是必填值
// 其它东西,通过组合
Err error
}
type QueryResp struct {
BaseResp
IsDuringSearch bool `json:"isDuringSearch"` // 是否是搜索的过程结果,发送时指定 reportDuringSearchEvery则会在过程中进行回复
TurnNumber int32 `json:"turnNumber"` // 正在分析的回合数(手数)
MoveInfos []struct {
Move string `json:"move"` // 正在分析的移动,通常为棋盘坐标
Visits int32 `json:"visits"` // 访问次数(神经网络)
WinRate float64 `json:"winrate"` // 胜率 [0~1] [0%~100%] 越高越好
ScoreMean float64 `json:"scoreMean"` // 预计平均分
ScoreLead float64 `json:"scoreLead"` // 预计平均分 与 ScoreMean 一致
ScoreStdev float64 `json:"scoreStdev"` // 预计平均分标准差由于MCTS机制该分值可能偏高
ScoreSelfplay float64 `json:"scoreSelfplay"` // 自我对弈时的预计分数,该值目前偏高
Prior float64 `json:"prior"` // 策略优先级 [0~1],通常会选优先级高的下棋(直觉)
Utility float64 `json:"utility"` // 综合效用值结合winrate和score值域 [-C,C]
Lcb float64 `json:"lcb"` // LCB胜率但值可能有误 [0~1] 可能会越界
UtilityLcb float64 `json:"utilityLcb"` // LCB综合效用值
Weight float64 `json:"weight"` // Visits 的平均权重
Order int32 `json:"order"` // Katago神经网络中的直觉优先级值[0~max]越低,优先级越高
PV []string `json:"pv"` // 此次移动之后预测之后的移动列表
// PvVisits
// pvEdgeVisits
// ownership
// ownershipStdev
} `json:"moveInfos"` // 移动信息
RootInfo struct {
ThisHash string `json:"thisHash"` // 本次移动的唯一编码
SymHash string `json:"symHash"` //
CurrentPlayer string `json:"currentPlayer"` // "B" or "W"
// RawStWrError
// rawStScoreError
// rawVarTimeLeft
Visits int32 `json:"visits"` // 访问次数(神经网络)
WinRate float64 `json:"winrate"` // 胜率 [0~1] [0%~100%] 越高越好
ScoreLead float64 `json:"scoreLead"` // 预计平均分 与 ScoreMean 一致
ScoreSelfplay float64 `json:"scoreSelfplay"` // 自我对弈时的预计分数,该值目前偏高
Utility float64 `json:"utility"` // 综合效用值结合winrate和score值域 [-C,C]
} `json:"rootInfo"` // 根信息
}
type QueryVersionResp struct {
BaseResp
GitHash string `json:"git_hash"` // GitHash
Version string `json:"version"` // 版本号
}
type ClearCacheResp struct {
BaseResp
}
type TerminateResp struct {
BaseResp
IsDuringSearch bool `json:"isDuringSearch"` // 是否是搜索的过程结果,发送时指定 reportDuringSearchEvery则会在过程中进行回复
TurnNumber int64 `json:"turnNumber"` // 本次停止的回合数
}
type TerminateAllResp struct {
BaseResp
TurnNumbers []int64 `json:"turnNumbers"` // 本次停止的回合数
}