mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
36 lines
929 B
Go
Executable File
36 lines
929 B
Go
Executable File
// Copyright 2020 Team 254. All Rights Reserved.
|
|
// Author: pat@patfairbank.com (Patrick Fairbank)
|
|
//
|
|
// Model representing the instantaneous score of a match.
|
|
|
|
package game
|
|
|
|
type Score struct {
|
|
AutoPoints int
|
|
TeleopPoints int
|
|
EndgamePoints int
|
|
}
|
|
|
|
// Calculates and returns the summary fields used for ranking and display.
|
|
func (score *Score) Summarize() *ScoreSummary {
|
|
summary := new(ScoreSummary)
|
|
|
|
summary.AutoPoints = score.AutoPoints
|
|
summary.TeleopPoints = score.TeleopPoints
|
|
summary.EndgamePoints = score.EndgamePoints
|
|
summary.Score = summary.AutoPoints + summary.TeleopPoints + summary.EndgamePoints
|
|
|
|
return summary
|
|
}
|
|
|
|
// Returns true if and only if all fields of the two scores are equal.
|
|
func (score *Score) Equals(other *Score) bool {
|
|
if score.AutoPoints != other.AutoPoints ||
|
|
score.TeleopPoints != other.TeleopPoints ||
|
|
score.EndgamePoints != other.EndgamePoints {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|