reuse some slices

This commit is contained in:
sm
2013-09-07 19:13:12 -07:00
parent bf853880ca
commit b7087adb78
2 changed files with 5 additions and 5 deletions
+4 -3
View File
@@ -44,6 +44,7 @@ func NewGame(id string, width, height float64) *game {
func (g *game) run() {
started := false
var t0, t1 time.Time
payload := bot.NewBoardstate()
for {
select {
case <-g.kill:
@@ -69,6 +70,8 @@ func (g *game) run() {
}
g.turn++
payload.Turn = g.turn
t0 = time.Now()
if *verbose {
@@ -78,9 +81,6 @@ func (g *game) run() {
log.Printf("Explosions: %v", len(g.splosions))
}
// TODO: making one of these every iteration seems wasteful
payload := bot.NewBoardstate(g.turn)
robots_remaining := 0
for p := range g.players {
@@ -140,6 +140,7 @@ func (g *game) run() {
log.Printf("Sent Payload %v\n", t1.Sub(t0))
}
payload.EmptySlices()
}
}
}