lockstep changes for server sending max points
This commit is contained in:
parent
787bf9b435
commit
b964a14bba
@ -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 {
|
||||||
|
2
main.go
2
main.go
@ -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{
|
||||||
|
6
robot.go
6
robot.go
@ -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,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user