Skip to content

Commit

Permalink
Merge pull request #56 from LeelaChessZero/master
Browse files Browse the repository at this point in the history
Merge master to release for v18.
  • Loading branch information
Tilps authored Sep 11, 2018
2 parents 78bbe2b + 41287ea commit 5f2f5db
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lc0_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"bufio"
"bytes"
"compress/gzip"
"crypto/rand"
"encoding/json"
"errors"
"flag"
Expand Down Expand Up @@ -35,6 +36,7 @@ var (
startTime time.Time
totalGames int
pendingNextGame *client.NextGameResponse
randId int

hostname = flag.String("hostname", "http://api.lczero.org", "Address of the server")
user = flag.String("user", "", "Username")
Expand All @@ -46,6 +48,7 @@ var (
`Options for the lc0 mux. backend. Example: --backend-opts="cudnn(gpu=1)"`)
parallel = flag.Int("parallelism", -1, "Number of games to play in parallel (-1 for default)")
useTestServer = flag.Bool("use-test-server", false, "Set host name to test server.")
keep = flag.Bool("keep", false, "Do not delete old network files")
)

// Settings holds username and password.
Expand Down Expand Up @@ -98,7 +101,8 @@ func getExtraParams() map[string]string {
return map[string]string{
"user": *user,
"password": *password,
"version": "17",
"version": "18",
"token": strconv.Itoa(randId),
}
}

Expand Down Expand Up @@ -624,7 +628,7 @@ func nextGame(httpClient *http.Client, count int) error {
}

if nextGame.Type == "train" {
networkPath, err := getNetwork(httpClient, nextGame.Sha, true)
networkPath, err := getNetwork(httpClient, nextGame.Sha, !*keep)
if err != nil {
return err
}
Expand Down Expand Up @@ -696,6 +700,13 @@ func hideLc0argsFlag() {
}

func main() {
randBytes := make([]byte, 2)
_, err := rand.Reader.Read(randBytes)
if err != nil {
randId = -1
} else {
randId = int(randBytes[0]) << 8 | int(randBytes[1])
}
testEP()

hideLc0argsFlag()
Expand Down

0 comments on commit 5f2f5db

Please sign in to comment.