Skip to content

Instantly share code, notes, and snippets.

@tigris
Created September 26, 2016 09:18
Show Gist options
  • Save tigris/a0a2a37169ae10d6a725c5d09402b7df to your computer and use it in GitHub Desktop.
Save tigris/a0a2a37169ae10d6a725c5d09402b7df to your computer and use it in GitHub Desktop.
Convert game stats to brownlow votes
def brownlow_total(s)
disposals = s[:kicks] + s[:handballs]
disposal_modifier = case
when disposals > 40; then 10
when disposals > 30; then 5
when disposals > 20; then 1
else 0
end
marks_modifier = case
when s[:marks] > 10; then 5
when s[:marks] > 7; then 2
else 0
end
goals_modifier = case
when s[:goals] > 10; then 15
when s[:goals] > 6; then 8
when s[:goals] > 5; then 5
when s[:goals] > 4; then 4
when s[:goals] > 3; then 2
else 0
end
clearances_modifier = case
when s[:clearances] > 10; then 5
when s[:clearances] > 6; then 2
else 0
end
tackles_modifier = case
when s[:tackles] > 10; then 5
when s[:tackles] > 7; then 2
else 0
end
hitouts_modifier = case
when s[:hit_outs] > 40; then 10
when s[:hit_outs] > 30; then 5
else 0
end
return disposals + disposal_modifier + marks_modifier + s[:goals] + goals_modifier + clearances_modifier + tackles_modifier + hitouts_modifier
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment