fix: sync逻辑添加 setLevel

main v1.3.3
NoahLan 11 months ago
parent 4aa8b76f09
commit 143ec53b66

@ -327,12 +327,13 @@ func (e *GtpEngine) SetFreeHandicap(vexArr ...string) bool {
// Sync 同步 // Sync 同步
// handicaps: points of all handicaps // handicaps: points of all handicaps
// plays: [][2]string -> [["B","A1"]] // plays: [][2]string -> [["B","A1"]]
func (e *GtpEngine) Sync(size int, komi float64, handicaps []string, plays [][]string) bool { func (e *GtpEngine) Sync(size int, komi float64, level int, handicaps []string, plays [][]string) bool {
// 1. komi // 1. komi
// 2. boardsize // 2. boardsize
// 3. clear_board // 3. set_level
// 4. set_free_handicap pos1 pos2 ... // 4. clear_board
// 5~n. play X XX // 5. set_free_handicap pos1 pos2 ...
// 6~n. play X XX
playAllFn := func() bool { playAllFn := func() bool {
return narr.Every(plays, func(_ int, v []string) bool { return narr.Every(plays, func(_ int, v []string) bool {
@ -346,6 +347,7 @@ func (e *GtpEngine) Sync(size int, komi float64, handicaps []string, plays [][]s
return e.Komi(komi) && return e.Komi(komi) &&
e.BoardSize(size) && e.BoardSize(size) &&
e.SetLevel(level) &&
e.ClearBoard() && e.ClearBoard() &&
e.SetFreeHandicap(handicaps...) && e.SetFreeHandicap(handicaps...) &&
playAllFn() playAllFn()

Loading…
Cancel
Save