make it simple to track last time
This commit is contained in:
parent
1ca4679b04
commit
45cc67a5f1
7
game.go
7
game.go
@ -43,6 +43,7 @@ func NewGame(id string, width, height float64) *game {
|
||||
|
||||
func (g *game) run() {
|
||||
started := false
|
||||
var t0, t1 time.Time
|
||||
for {
|
||||
select {
|
||||
case <-g.kill:
|
||||
@ -68,7 +69,7 @@ func (g *game) run() {
|
||||
}
|
||||
|
||||
g.turn++
|
||||
t0 := time.Now()
|
||||
t0 = time.Now()
|
||||
|
||||
if *verbose {
|
||||
log.Printf("\033[2JTurn: %v", g.turn)
|
||||
@ -97,7 +98,7 @@ func (g *game) run() {
|
||||
}
|
||||
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 {
|
||||
// XXX: p.nudge()
|
||||
@ -123,7 +124,7 @@ func (g *game) run() {
|
||||
payload.Reset = false
|
||||
}
|
||||
|
||||
t1 := time.Now()
|
||||
t1 = time.Now()
|
||||
if *verbose {
|
||||
log.Printf("Turn Processes %v\n", t1.Sub(t0))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user