game generation process
This commit is contained in:
@@ -4,6 +4,18 @@ 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.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user