mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Update final scores screen for 2018.
This commit is contained in:
@@ -40,12 +40,20 @@ func (score *Score) Summarize(opponentFouls []Foul) *ScoreSummary {
|
||||
}
|
||||
|
||||
// Calculate autonomous score.
|
||||
summary.AutoRunPoints = 5 * score.AutoRuns
|
||||
autoRuns := score.AutoRuns
|
||||
if autoRuns > 3 {
|
||||
autoRuns = 3
|
||||
}
|
||||
summary.AutoRunPoints = 5 * autoRuns
|
||||
summary.AutoPoints = summary.AutoRunPoints + score.AutoOwnershipPoints
|
||||
|
||||
// Calculate teleop score.
|
||||
summary.OwnershipPoints = score.AutoOwnershipPoints + score.TeleopOwnershipPoints
|
||||
summary.VaultPoints = 5 * score.VaultCubes
|
||||
vaultCubes := score.VaultCubes
|
||||
if vaultCubes > 9 {
|
||||
vaultCubes = 9
|
||||
}
|
||||
summary.VaultPoints = 5 * vaultCubes
|
||||
climbs := score.Climbs
|
||||
if climbs > 3 {
|
||||
climbs = 3
|
||||
@@ -60,7 +68,7 @@ func (score *Score) Summarize(opponentFouls []Foul) *ScoreSummary {
|
||||
summary.ParkClimbPoints = 5*parks + 30*climbs
|
||||
|
||||
// Calculate bonuses.
|
||||
if score.AutoRuns == 3 && score.AutoEndSwitchOwnership {
|
||||
if autoRuns == 3 && score.AutoEndSwitchOwnership {
|
||||
summary.AutoQuest = true
|
||||
}
|
||||
if climbs == 3 {
|
||||
|
||||
@@ -34,7 +34,11 @@ func TestScoreSummary(t *testing.T) {
|
||||
assert.Equal(t, true, blueSummary.AutoQuest)
|
||||
assert.Equal(t, false, blueSummary.FaceTheBoss)
|
||||
|
||||
// Test park/climb limits.
|
||||
// Test limits on fields with a natural cap.
|
||||
blueScore.AutoRuns = 5
|
||||
assert.Equal(t, 15, blueScore.Summarize(redScore.Fouls).AutoRunPoints)
|
||||
redScore.VaultCubes = 20
|
||||
assert.Equal(t, 45, redScore.Summarize(blueScore.Fouls).VaultPoints)
|
||||
redScore.Levitate = false
|
||||
redScore.Climbs = 3
|
||||
assert.Equal(t, 90, redScore.Summarize(blueScore.Fouls).ParkClimbPoints)
|
||||
@@ -52,6 +56,7 @@ func TestScoreSummary(t *testing.T) {
|
||||
assert.Equal(t, 40, redScore.Summarize(blueScore.Fouls).ParkClimbPoints)
|
||||
|
||||
// Test Auto Quest boundary conditions.
|
||||
assert.Equal(t, true, blueScore.Summarize(redScore.Fouls).AutoQuest)
|
||||
blueScore.AutoEndSwitchOwnership = false
|
||||
assert.Equal(t, false, blueScore.Summarize(redScore.Fouls).AutoQuest)
|
||||
blueScore.AutoEndSwitchOwnership = true
|
||||
|
||||
Reference in New Issue
Block a user