game generation process

This commit is contained in:
Ilia Denisov
2025-09-25 02:13:16 +03:00
parent 99035fd95d
commit 46066d890b
12 changed files with 206 additions and 101 deletions
+12
View File
@@ -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.
}