From 8c742910f917e0c9a450877b31d25c7aa4af3d1c Mon Sep 17 00:00:00 2001 From: Patrick Fairbank Date: Fri, 26 Jul 2019 23:13:42 -0700 Subject: [PATCH] Correct foul values for 2019. --- game/foul.go | 4 ++-- game/ranking_fields_test.go | 6 +++--- game/score_test.go | 10 +++++----- game/test_helpers.go | 6 +++--- web/match_play_test.go | 4 ++-- web/match_review_test.go | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/game/foul.go b/game/foul.go index 6fb3167..8cec36d 100644 --- a/game/foul.go +++ b/game/foul.go @@ -55,10 +55,10 @@ var Rules = []Rule{ func (foul *Foul) PointValue() int { if foul.IsTechnical { - return 25 + return 10 } else if foul.IsRankingPoint { return 0 } else { - return 5 + return 3 } } diff --git a/game/ranking_fields_test.go b/game/ranking_fields_test.go index 255911e..4dd2cc0 100644 --- a/game/ranking_fields_test.go +++ b/game/ranking_fields_test.go @@ -24,15 +24,15 @@ func TestAddScoreSummary(t *testing.T) { // Add a win. rankingFields.AddScoreSummary(blueSummary, redSummary, false) - assert.Equal(t, RankingFields{4, 42, 20, 27, 15, 0.24496508529377975, 1, 1, 0, 0, 2}, rankingFields) + assert.Equal(t, RankingFields{4, 48, 24, 33, 15, 0.24496508529377975, 1, 1, 0, 0, 2}, rankingFields) // Add a tie. rankingFields.AddScoreSummary(redSummary, redSummary, false) - assert.Equal(t, RankingFields{6, 72, 40, 39, 24, 0.6559562651954052, 1, 1, 1, 0, 3}, rankingFields) + assert.Equal(t, RankingFields{6, 78, 44, 45, 24, 0.6559562651954052, 1, 1, 1, 0, 3}, rankingFields) // Add a disqualification. rankingFields.AddScoreSummary(blueSummary, redSummary, true) - assert.Equal(t, RankingFields{6, 72, 40, 39, 24, 0.6559562651954052, 1, 1, 1, 1, 4}, rankingFields) + assert.Equal(t, RankingFields{6, 78, 44, 45, 24, 0.6559562651954052, 1, 1, 1, 1, 4}, rankingFields) } func TestSortRankings(t *testing.T) { diff --git a/game/score_test.go b/game/score_test.go index efd6fad..b36c1e2 100644 --- a/game/score_test.go +++ b/game/score_test.go @@ -23,12 +23,12 @@ func TestScoreSummary(t *testing.T) { assert.Equal(t, false, redSummary.HabDocking) blueSummary := blueScore.Summarize(redScore.Fouls) - assert.Equal(t, 12, blueSummary.CargoPoints) - assert.Equal(t, 0, blueSummary.HatchPanelPoints) - assert.Equal(t, 15, blueSummary.HabClimbPoints) + assert.Equal(t, 18, blueSummary.CargoPoints) + assert.Equal(t, 4, blueSummary.HatchPanelPoints) + assert.Equal(t, 21, blueSummary.HabClimbPoints) assert.Equal(t, 6, blueSummary.SandstormBonusPoints) - assert.Equal(t, 55, blueSummary.FoulPoints) - assert.Equal(t, 88, blueSummary.Score) + assert.Equal(t, 23, blueSummary.FoulPoints) + assert.Equal(t, 72, blueSummary.Score) assert.Equal(t, false, blueSummary.CompleteRocket) assert.Equal(t, true, blueSummary.HabDocking) diff --git a/game/test_helpers.go b/game/test_helpers.go index ffeaabe..225284e 100644 --- a/game/test_helpers.go +++ b/game/test_helpers.go @@ -38,9 +38,9 @@ func TestScore2() *Score { BayHatchCargo}, RocketNearLeftBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty}, RocketNearRightBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty}, - RocketFarLeftBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty}, - RocketFarRightBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty}, - RobotEndLevels: [3]int{1, 2, 2}, + RocketFarLeftBays: [3]BayStatus{BayHatchCargo, BayEmpty, BayEmpty}, + RocketFarRightBays: [3]BayStatus{BayEmpty, BayEmpty, BayHatchCargo}, + RobotEndLevels: [3]int{1, 3, 2}, Fouls: []Foul{}, ElimDq: false, } diff --git a/web/match_play_test.go b/web/match_play_test.go index 6075fc0..c1795ce 100644 --- a/web/match_play_test.go +++ b/web/match_play_test.go @@ -177,8 +177,8 @@ func TestCommitEliminationTie(t *testing.T) { matchResult := &model.MatchResult{ MatchId: match.Id, RedScore: &game.Score{ - RocketFarRightBays: [3]game.BayStatus{game.BayHatchCargo, game.BayEmpty, game.BayEmpty}, - Fouls: []game.Foul{{}}}, + RocketFarRightBays: [3]game.BayStatus{game.BayHatchCargo, game.BayHatch, game.BayHatch}, + Fouls: []game.Foul{{}, {}, {}}}, BlueScore: &game.Score{}, } err := web.commitMatchScore(match, matchResult, false) diff --git a/web/match_review_test.go b/web/match_review_test.go index 38fb712..e78e0b4 100644 --- a/web/match_review_test.go +++ b/web/match_review_test.go @@ -50,7 +50,7 @@ func TestMatchReviewEditExistingResult(t *testing.T) { assert.Equal(t, 200, recorder.Code) assert.Contains(t, recorder.Body.String(), "QF4-3") assert.Contains(t, recorder.Body.String(), "71") // The red score - assert.Contains(t, recorder.Body.String(), "88") // The blue score + assert.Contains(t, recorder.Body.String(), "72") // The blue score // Check response for non-existent match. recorder = web.getHttpResponse(fmt.Sprintf("/match_review/%d/edit", 12345)) @@ -71,7 +71,7 @@ func TestMatchReviewEditExistingResult(t *testing.T) { recorder = web.getHttpResponse("/match_review") assert.Equal(t, 200, recorder.Code) assert.Contains(t, recorder.Body.String(), "QF4-3") - assert.Contains(t, recorder.Body.String(), "17") // The red score + assert.Contains(t, recorder.Body.String(), "15") // The red score assert.Contains(t, recorder.Body.String(), "19") // The blue score }