feat: finish game; store reports

This commit is contained in:
Ilia Denisov
2026-02-04 14:21:37 +02:00
parent abc98ee72f
commit 9a6d4112cf
6 changed files with 43 additions and 10 deletions
+12
View File
@@ -30,6 +30,18 @@ func (n VoteNode) String() string {
return fmt.Sprintf("%s%d%s", lh, n.ID, rh)
}
func (c *Cache) TurnAcceptWinners(v []int) {
if c.g.Finished() {
panic("game is already has its winner(s)")
}
if len(v) == 0 {
return
}
for _, ri := range v {
c.g.Winner = append(c.g.Winner, c.g.Race[ri].ID)
}
}
func (c *Cache) TurnCalculateVotes() []int {
raceVotes := c.votesByRace()
calc := GroupVotes(raceVotes, VotingGraph(c.g.Race, c.RaceIndex))