diff --git a/botserv.go b/botserv.go index 1a42497..993a08e 100644 --- a/botserv.go +++ b/botserv.go @@ -15,10 +15,13 @@ type BoardSize struct { Height float32 `json:"height"` } +// This is kind of misused here; we set Name, but expect to get the other +// values back from the server type GameParam struct { BoardSize BoardSize `json:"boardsize"` - name string - Type string `json:"type"` + MaxPoints int `json:"max_points"` + Name string `json:"name"` + Type string `json:"type"` } type StatsRequest struct { diff --git a/main.go b/main.go index 3633c4b..15f506c 100644 --- a/main.go +++ b/main.go @@ -48,7 +48,7 @@ func main() { port: *port, name: fmt.Sprintf("%s%d", *botname, i), game: GameParam{ - name: gameName, + Name: gameName, }, // XXX: update with missing fields stats: StatsRequest{ diff --git a/robot.go b/robot.go index d9bf1fd..cdff203 100644 --- a/robot.go +++ b/robot.go @@ -45,7 +45,7 @@ type robot struct { func (r *robot) negociate() (err error) { if *verbose { - log.Printf("%s: trying to connect to game '%s'", r.name, r.game.name) + log.Printf("%s: trying to connect to game '%s'", r.name, r.game.Name) } r.ws, err = connect(r.server, r.port) if err != nil { @@ -55,7 +55,7 @@ func (r *robot) negociate() (err error) { err = websocket.JSON.Send(r.ws, struct { Id string `json:"id"` }{ - r.game.name, + r.game.Name, }) if err != nil { return err @@ -94,7 +94,7 @@ func (r *robot) negociate() (err error) { } conf := ClientConfig{ - ID: r.game.name, + ID: r.game.Name, Stats: map[string]StatsRequest{ r.name: r.stats, },