server/deathmatch.go
Stephen McQuay c8efd34080 ignore new binary
Create new bserv binary

Herein lie the following ideas:

- change package visibility of many things
- try to stash the globals into structs
- the code is far from correct; it merely compiles
2014-03-31 23:21:14 -07:00

46 lines
915 B
Go

package botserv
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 {
gg.stats.Lock()
playerWin := false
for _, r := range p.Robots {
if r.Health > 0 {
log.Printf("Robot %v Survived", r.Id)
gg.stats.PlayerStats[p.Id].BotStats[r.Name].Wins += 1
stats.Winners = append(stats.Winners, r.Id)
playerWin = true
}
r.reset(gg)
}
if playerWin {
gg.stats.PlayerStats[p.Id].Wins += 1
}
gg.stats.Unlock()
}
over = true
}
return over, stats
}
func (g *deathmatch) tick(gg *Game, payload *Boardstate) {
}