added verbose flag

This commit is contained in:
Stephen McQuay 2013-10-14 08:51:06 -07:00
parent 1924d613f0
commit e55e1c6883

View File

@ -21,6 +21,7 @@ var scannerRadius = flag.Int("srad", 100, "scanner radius")
var server = flag.String("server", "localhost", "server hostname") var server = flag.String("server", "localhost", "server hostname")
var port = flag.Int("port", 8666, "server port") var port = flag.Int("port", 8666, "server port")
var botname = flag.String("name", "gobot", "the name that other players will see") var botname = flag.String("name", "gobot", "the name that other players will see")
var verbose = flag.Bool("verbose", false, "run verbosly")
type infos struct { type infos struct {
id string id string
@ -228,6 +229,9 @@ func main() {
Turn int `json:"turn"` Turn int `json:"turn"`
} }
err = websocket.JSON.Receive(ws, &boardstate) err = websocket.JSON.Receive(ws, &boardstate)
if *verbose {
log.Printf("%+v", boardstate)
}
if err != nil { if err != nil {
log.Fatal("Connection lost") log.Fatal("Connection lost")
} }