seed prng, be less verbose

This commit is contained in:
Stephen McQuay 2013-09-28 13:10:25 -07:00
parent 535d5ac445
commit bc92c2e01f

View File

@ -10,6 +10,7 @@ import (
"log"
"math/rand"
"net/http"
"time"
)
var hp = flag.Int("hp", 150, "")
@ -184,6 +185,7 @@ func negociate(ws *websocket.Conn, gameid string) (i *infos, err error) {
}
func main() {
rand.Seed(time.Now().UnixNano())
var err error
var gameid string
flag.Parse()
@ -234,16 +236,16 @@ func main() {
break
}
}
log.Printf("%+v: %+v", me.Position, moveto)
if govector.Distance(me.Position, moveto) < 3.0 {
log.Printf("old: %+v: %+v", me.Position, moveto)
moveto = govector.Point2d{
X: rand.Float64() * board_info.width,
Y: rand.Float64() * board_info.height,
}
log.Printf("new: %+v: %+v", me.Position, moveto)
}
// TODO: send instructions
log.Printf("%+v: %+v", me.Position, moveto)
err = websocket.JSON.Send(ws, Instruction{
MoveTo: &moveto,
})