feat: finish game; store reports
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user