package main import ( "log" ) type deathmatch struct { } func (g *deathmatch) setup(gg *game) { } func (g *deathmatch) gameOver(gg *game) (bool, *GameOver) { over := false var stats *GameOver if gg.players_remaining <= 1 && len(gg.players) > 1 { gg.obstacles = GenerateObstacles(gg.obstacle_count, gg.width, gg.height) log.Printf("game %s: game over", gg.id) stats = NewGameOver() for p := range gg.players { for _, r := range p.Robots { if r.Health > 0 { log.Printf("Robot %v Survived", r.Id) gg.winners.Lock() gg.winners.m[r.Id] += 1 gg.winners.Unlock() stats.Winners = append(stats.Winners, r.Id) } r.reset(gg) } } over = true } return over, stats } func (g *deathmatch) tick(gg *game, payload *Boardstate) { }