Skip to content

Commit

Permalink
Merge pull request #113 from Tilps/check_version
Browse files Browse the repository at this point in the history
Check Tilps/chess version
  • Loading branch information
Tilps authored Apr 8, 2020
2 parents 828324b + af4277b commit 19e1e1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Pull or download the `master` branch
Then to produce a `lczero-client` executable:
`go build lc0_main.go` for the `lc0` client

If you get
`.\lc0_main.go:1048:5: undefined: chess.GetLibraryVersion`
you have a cached old version of Tilps/chess and need to run the Pre-reqs again.

# Running

First copy the `lc0` executable into the same folder as the `lczero-client` executable.
Expand Down Expand Up @@ -52,4 +56,4 @@ Building the client for each platform:
GOOS=windows GOARCH=amd64 go build -o lczero-client.exe
GOOS=darwin GOARCH=amd64 go build -o lczero-client_mac
GOOS=linux GOARCH=amd64 go build -o lczero-client_linux
```
```
15 changes: 4 additions & 11 deletions lc0_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,16 +1043,9 @@ func nextGame(httpClient *http.Client, count int) error {
return errors.New("Unknown game type: " + nextGame.Type)
}

// Check if PGN may contain "e.p." to verify that the chess package is recent
func testEP() {
game := chess.NewGame(chess.UseNotation(chess.AlgebraicNotation{}))
game.MoveStr("a4")
game.MoveStr("c5")
game.MoveStr("a5")
game.MoveStr("b5")
game.MoveStr("axb6")

if strings.Contains(game.String(), "e.p.") {
// Ensure Tilps/chess is new enough.
func testChessVersion() {
if chess.GetLibraryVersion() < 3 {
log.Fatal("You need a more recent version of package github.com/Tilps/chess")
}
}
Expand Down Expand Up @@ -1086,7 +1079,7 @@ func maybeSetTrainOnly() {
func main() {
fmt.Printf("Lc0 client version %v\n", getExtraParams()["version"])

testEP()
testChessVersion()

hideLc0argsFlag()
flag.Parse()
Expand Down

0 comments on commit 19e1e1b

Please sign in to comment.