Files
galaxy-game/pkg/model/game/game.go
T
2025-09-25 02:13:16 +03:00

22 lines
415 B
Go

package game
import "github.com/google/uuid"
type Game struct {
ID uuid.UUID
Age uint // Game's turn number
Map Map
Race []Race
}
func (g Game) Votes(raceID uuid.UUID) float64 {
// XXX: calculate [Race]Population once when loading Game from Storage?
var pop float64
for i := range g.Map.Planet {
if g.Map.Planet[i].Owner == raceID {
pop += g.Map.Planet[i].Population
}
}
return pop / 1000.
}