make it simple to track last time

This commit is contained in:
Stephen McQuay 2013-09-05 23:31:13 -07:00
parent 1ca4679b04
commit 45cc67a5f1

View File

@ -43,6 +43,7 @@ func NewGame(id string, width, height float64) *game {
func (g *game) run() { func (g *game) run() {
started := false started := false
var t0, t1 time.Time
for { for {
select { select {
case <-g.kill: case <-g.kill:
@ -68,7 +69,7 @@ func (g *game) run() {
} }
g.turn++ g.turn++
t0 := time.Now() t0 = time.Now()
if *verbose { if *verbose {
log.Printf("\033[2JTurn: %v", g.turn) log.Printf("\033[2JTurn: %v", g.turn)
@ -97,7 +98,7 @@ func (g *game) run() {
} }
payload.Robots = append(payload.Robots, p.Robot) payload.Robots = append(payload.Robots, p.Robot)
} }
sort.Sort(bot.RobotSorter{payload.Robots}) sort.Sort(bot.RobotSorter{Robots: payload.Robots})
for p := range g.projectiles { for p := range g.projectiles {
// XXX: p.nudge() // XXX: p.nudge()
@ -123,7 +124,7 @@ func (g *game) run() {
payload.Reset = false payload.Reset = false
} }
t1 := time.Now() t1 = time.Now()
if *verbose { if *verbose {
log.Printf("Turn Processes %v\n", t1.Sub(t0)) log.Printf("Turn Processes %v\n", t1.Sub(t0))
} }