Support newer versions of gnubg
This commit is contained in:
parent
6cefc2342e
commit
ff05d4a1dd
1 changed files with 3 additions and 3 deletions
6
gnubg.go
6
gnubg.go
|
@ -218,11 +218,11 @@ func analyze(g *bgammon.Game) ([4][2]int8, error) {
|
|||
return [4][2]int8{}, err
|
||||
}
|
||||
|
||||
moves = bytes.TrimSpace(moves)
|
||||
if !bytes.HasPrefix(moves, []byte("gnubg moves ")) {
|
||||
movesWord := bytes.Index(moves, []byte("moves"))
|
||||
if movesWord == -1 {
|
||||
return [4][2]int8{}, fmt.Errorf("failed to parse gnubg moves: %s", moves)
|
||||
}
|
||||
moves = moves[12:]
|
||||
moves = bytes.TrimSpace(moves[movesWord+6:])
|
||||
if !bytes.HasSuffix(moves, []byte(".")) {
|
||||
return [4][2]int8{}, fmt.Errorf("failed to parse gnubg moves: %s", moves)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue