Skip to content

Commit

Permalink
Correct default values for sustainability bonus thresholds.
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed Sep 26, 2023
1 parent 05f1fa1 commit 6037a09
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions game/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type Score struct {
PlayoffDq bool
}

var SustainabilityBonusLinkThresholdWithoutCoop = 7
var SustainabilityBonusLinkThresholdWithCoop = 6
var SustainabilityBonusLinkThresholdWithoutCoop = 6
var SustainabilityBonusLinkThresholdWithCoop = 5
var ActivationBonusPointThreshold = 26

// Represents the state of a robot at the end of the match.
Expand Down
16 changes: 8 additions & 8 deletions game/score_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestScoreSummary(t *testing.T) {
assert.Equal(t, 78, redSummary.Score)
assert.Equal(t, false, redSummary.CoopertitionBonus)
assert.Equal(t, 0, redSummary.NumLinks)
assert.Equal(t, 7, redSummary.NumLinksGoal)
assert.Equal(t, 6, redSummary.NumLinksGoal)
assert.Equal(t, false, redSummary.SustainabilityBonusRankingPoint)
assert.Equal(t, false, redSummary.ActivationBonusRankingPoint)
assert.Equal(t, 0, redSummary.BonusRankingPoints)
Expand All @@ -42,7 +42,7 @@ func TestScoreSummary(t *testing.T) {
assert.Equal(t, 216, blueSummary.Score)
assert.Equal(t, false, blueSummary.CoopertitionBonus)
assert.Equal(t, 9, blueSummary.NumLinks)
assert.Equal(t, 7, blueSummary.NumLinksGoal)
assert.Equal(t, 6, blueSummary.NumLinksGoal)
assert.Equal(t, true, blueSummary.SustainabilityBonusRankingPoint)
assert.Equal(t, true, blueSummary.ActivationBonusRankingPoint)
assert.Equal(t, 2, blueSummary.BonusRankingPoints)
Expand All @@ -69,11 +69,11 @@ func TestScoreSustainabilityBonusRankingPoint(t *testing.T) {
blueScoreSummary := blueScore.Summarize(redScore)
assert.Equal(t, false, redScoreSummary.CoopertitionBonus)
assert.Equal(t, 0, redScoreSummary.NumLinks)
assert.Equal(t, 7, redScoreSummary.NumLinksGoal)
assert.Equal(t, 6, redScoreSummary.NumLinksGoal)
assert.Equal(t, false, redScoreSummary.SustainabilityBonusRankingPoint)
assert.Equal(t, false, blueScoreSummary.CoopertitionBonus)
assert.Equal(t, 9, blueScoreSummary.NumLinks)
assert.Equal(t, 7, blueScoreSummary.NumLinksGoal)
assert.Equal(t, 6, blueScoreSummary.NumLinksGoal)
assert.Equal(t, true, blueScoreSummary.SustainabilityBonusRankingPoint)

// Reduce blue links to 8 and verify that the bonus is still awarded.
Expand All @@ -82,11 +82,11 @@ func TestScoreSustainabilityBonusRankingPoint(t *testing.T) {
blueScoreSummary = blueScore.Summarize(redScore)
assert.Equal(t, false, redScoreSummary.CoopertitionBonus)
assert.Equal(t, 0, redScoreSummary.NumLinks)
assert.Equal(t, 7, redScoreSummary.NumLinksGoal)
assert.Equal(t, 6, redScoreSummary.NumLinksGoal)
assert.Equal(t, false, redScoreSummary.SustainabilityBonusRankingPoint)
assert.Equal(t, false, blueScoreSummary.CoopertitionBonus)
assert.Equal(t, 8, blueScoreSummary.NumLinks)
assert.Equal(t, 7, blueScoreSummary.NumLinksGoal)
assert.Equal(t, 6, blueScoreSummary.NumLinksGoal)
assert.Equal(t, true, blueScoreSummary.SustainabilityBonusRankingPoint)

// Increase non-coopertition threshold to 9.
Expand Down Expand Up @@ -122,11 +122,11 @@ func TestScoreSustainabilityBonusRankingPoint(t *testing.T) {
blueScoreSummary = blueScore.Summarize(redScore)
assert.Equal(t, true, redScoreSummary.CoopertitionBonus)
assert.Equal(t, 0, redScoreSummary.NumLinks)
assert.Equal(t, 6, redScoreSummary.NumLinksGoal)
assert.Equal(t, 5, redScoreSummary.NumLinksGoal)
assert.Equal(t, false, redScoreSummary.SustainabilityBonusRankingPoint)
assert.Equal(t, true, blueScoreSummary.CoopertitionBonus)
assert.Equal(t, 6, blueScoreSummary.NumLinks)
assert.Equal(t, 6, blueScoreSummary.NumLinksGoal)
assert.Equal(t, 5, blueScoreSummary.NumLinksGoal)
assert.Equal(t, true, blueScoreSummary.SustainabilityBonusRankingPoint)

// Reduce coopertition threshold to 1 and make red fulfill the sustainability bonus requirement.
Expand Down
4 changes: 2 additions & 2 deletions model/event_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func TestEventSettingsReadWrite(t *testing.T) {
PauseDurationSec: 3,
TeleopDurationSec: 135,
WarningRemainingDurationSec: 30,
SustainabilityBonusLinkThresholdWithoutCoop: 7,
SustainabilityBonusLinkThresholdWithCoop: 6,
SustainabilityBonusLinkThresholdWithoutCoop: 6,
SustainabilityBonusLinkThresholdWithCoop: 5,
ActivationBonusPointThreshold: 26,
},
*eventSettings,
Expand Down

0 comments on commit 6037a09

Please sign in to comment.