mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Remove game-specific scoring
This commit is contained in:
17
game/ranking_fields.go
Normal file → Executable file
17
game/ranking_fields.go
Normal file → Executable file
@@ -16,7 +16,6 @@ type RankingFields struct {
|
||||
Wins int
|
||||
Losses int
|
||||
Ties int
|
||||
Disqualifications int
|
||||
Played int
|
||||
}
|
||||
|
||||
@@ -29,18 +28,12 @@ type Ranking struct {
|
||||
|
||||
type Rankings []Ranking
|
||||
|
||||
func (fields *RankingFields) AddScoreSummary(ownScore *ScoreSummary, opponentScore *ScoreSummary, disqualified bool) {
|
||||
func (fields *RankingFields) AddScoreSummary(ownScore *ScoreSummary, opponentScore *ScoreSummary) {
|
||||
fields.Played += 1
|
||||
|
||||
// Store a random value to be used as the last tiebreaker if necessary.
|
||||
fields.Random = rand.Float64()
|
||||
|
||||
if disqualified {
|
||||
// Don't award any points.
|
||||
fields.Disqualifications += 1
|
||||
return
|
||||
}
|
||||
|
||||
// Assign ranking points and wins/losses/ties.
|
||||
if ownScore.Score > opponentScore.Score {
|
||||
fields.RankingPoints += 2
|
||||
@@ -51,17 +44,11 @@ func (fields *RankingFields) AddScoreSummary(ownScore *ScoreSummary, opponentSco
|
||||
} else {
|
||||
fields.Losses += 1
|
||||
}
|
||||
if ownScore.ControlPanelRankingPoint {
|
||||
fields.RankingPoints += 1
|
||||
}
|
||||
if ownScore.EndgameRankingPoint {
|
||||
fields.RankingPoints += 1
|
||||
}
|
||||
|
||||
// Assign tiebreaker points.
|
||||
fields.AutoPoints += ownScore.AutoPoints
|
||||
fields.EndgamePoints += ownScore.EndgamePoints
|
||||
fields.TeleopPoints += ownScore.TeleopPowerCellPoints + ownScore.ControlPanelPoints
|
||||
fields.TeleopPoints += ownScore.TeleopPoints
|
||||
}
|
||||
|
||||
// Helper function to implement the required interface for Sort.
|
||||
|
||||
Reference in New Issue
Block a user