lockstep changes for server sending max points

This commit is contained in:
Stephen McQuay 2014-01-22 22:14:02 -08:00
parent 787bf9b435
commit b964a14bba
3 changed files with 9 additions and 6 deletions

View File

@ -15,10 +15,13 @@ type BoardSize struct {
Height float32 `json:"height"` 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 { type GameParam struct {
BoardSize BoardSize `json:"boardsize"` BoardSize BoardSize `json:"boardsize"`
name string MaxPoints int `json:"max_points"`
Type string `json:"type"` Name string `json:"name"`
Type string `json:"type"`
} }
type StatsRequest struct { type StatsRequest struct {

View File

@ -48,7 +48,7 @@ func main() {
port: *port, port: *port,
name: fmt.Sprintf("%s%d", *botname, i), name: fmt.Sprintf("%s%d", *botname, i),
game: GameParam{ game: GameParam{
name: gameName, Name: gameName,
}, },
// XXX: update with missing fields // XXX: update with missing fields
stats: StatsRequest{ stats: StatsRequest{

View File

@ -45,7 +45,7 @@ type robot struct {
func (r *robot) negociate() (err error) { func (r *robot) negociate() (err error) {
if *verbose { 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) r.ws, err = connect(r.server, r.port)
if err != nil { if err != nil {
@ -55,7 +55,7 @@ func (r *robot) negociate() (err error) {
err = websocket.JSON.Send(r.ws, struct { err = websocket.JSON.Send(r.ws, struct {
Id string `json:"id"` Id string `json:"id"`
}{ }{
r.game.name, r.game.Name,
}) })
if err != nil { if err != nil {
return err return err
@ -94,7 +94,7 @@ func (r *robot) negociate() (err error) {
} }
conf := ClientConfig{ conf := ClientConfig{
ID: r.game.name, ID: r.game.Name,
Stats: map[string]StatsRequest{ Stats: map[string]StatsRequest{
r.name: r.stats, r.name: r.stats,
}, },