Skip to content

Commit

Permalink
Add overlooked movement point handling
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJCLaw committed Nov 16, 2024
1 parent 75c204f commit 602564f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scoring/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ def calculate_scores(self):
scores = {}

for tla, info in self._teams_data.items():
scores[tla] = sum(
district_score = sum(
self.score_district_for_zone(name, district, info['zone'])
for name, district in self._districts.items()
)
movement_score = 1 if info.get('left_starting_zone') else 0
scores[tla] = district_score + movement_score

return scores

Expand Down
11 changes: 11 additions & 0 deletions scoring/tests/test_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ def test_template(self):

# Scoring logic

def test_left_starting_zone(self) -> None:
self.teams_data['GGG']['left_starting_zone'] = True
self.assertScores(
{
'GGG': 1,
'OOO': 0,
},
self.districts,
)

def test_outer_single(self) -> None:
self.districts['outer_nw']['highest'] = 'G'
self.districts['outer_nw']['pallets'] = 'G'
Expand Down Expand Up @@ -194,6 +204,7 @@ def test_central_highest(self) -> None:
)

def test_mixed(self) -> None:
self.teams_data['OOO']['left_starting_zone'] = True
self.districts['outer_sw']['highest'] = 'O'
self.districts['outer_sw']['pallets'] = 'O'
self.districts['inner_sw']['highest'] = 'G'
Expand Down

0 comments on commit 602564f

Please sign in to comment.